diff --git a/src/pages/events/__tests__/summit-event-list-page.test.js b/src/pages/events/__tests__/summit-event-list-page.test.js
index d7b0f1424..00ab2f5c5 100644
--- a/src/pages/events/__tests__/summit-event-list-page.test.js
+++ b/src/pages/events/__tests__/summit-event-list-page.test.js
@@ -200,6 +200,81 @@ describe("SummitEventListPage", () => {
);
});
+ test("opens media upload material link using current summit id fallback", async () => {
+ renderWithRedux(, {
+ initialState: {
+ currentSummitState: {
+ currentSummit: {
+ id: 12,
+ time_zone: { name: "UTC" },
+ time_zone_id: "UTC",
+ selection_plans: [],
+ tracks: [],
+ event_types: [],
+ locations: [],
+ presentation_action_types: []
+ }
+ },
+ currentEventListState: {
+ events: [
+ {
+ id: 101,
+ type: { id: 1, name: "Presentation", use_speakers: true },
+ title: "Sample event",
+ selection_status: "pending",
+ media_uploads: [
+ {
+ id: 999,
+ created: "now",
+ media_upload_type: { name: "Slides" }
+ }
+ ]
+ }
+ ],
+ lastPage: 1,
+ currentPage: 1,
+ order: "id",
+ orderDir: 1,
+ totalEvents: 1,
+ term: "",
+ filters: {},
+ extraColumns: ["media_uploads"],
+ perPage: 10,
+ enabledFilters: []
+ }
+ }
+ });
+
+ const editableTableProps =
+ mockEditableTableSpy.mock.calls[
+ mockEditableTableSpy.mock.calls.length - 1
+ ][0];
+ const mediaUploadsColumn = editableTableProps.columns.find(
+ (col) => col.columnKey === "media_uploads"
+ );
+
+ const mediaUploadItem = {
+ id: 999,
+ created: "now",
+ media_upload_type: { name: "Slides" }
+ };
+
+ const rendered = mediaUploadsColumn.render([mediaUploadItem], { id: 101 });
+ const firstRow = rendered.props.children[0];
+ const firstButton = Array.isArray(firstRow.props.children)
+ ? firstRow.props.children[0]
+ : firstRow.props.children;
+
+ firstButton.props.onClick({
+ preventDefault: jest.fn()
+ });
+
+ expect(windowOpenSpy).toHaveBeenCalledWith(
+ "/app/summits/12/events/101/materials/999",
+ "_blank"
+ );
+ });
+
test("does not open media upload material link when row event id is missing", async () => {
renderWithRedux(, {
initialState: {
diff --git a/src/pages/events/summit-event-list-page.js b/src/pages/events/summit-event-list-page.js
index bf67fe11c..9e1e27a95 100644
--- a/src/pages/events/summit-event-list-page.js
+++ b/src/pages/events/summit-event-list-page.js
@@ -69,7 +69,12 @@ import {
import { CONTEXT_ACTIVITIES } from "../../utils/filter-criteria-constants";
import EditableTable from "../../components/tables/editable-table/EditableTable";
-const fieldNames = (allSelectionPlans, allTracks, event_types) => [
+const fieldNames = (
+ allSelectionPlans,
+ allTracks,
+ event_types,
+ currentSummitId
+) => [
{
columnKey: "speakers",
value: "speakers",
@@ -263,9 +268,9 @@ const fieldNames = (allSelectionPlans, allTracks, event_types) => [
className="text-link-button"
onClick={(ev) => {
ev.preventDefault();
- if (!row?.id) return false;
+ if (!row?.id || !currentSummitId) return false;
window.open(
- `/app/summits/${m.summit_id}/events/${row.id}/materials/${m.id}`,
+ `/app/summits/${currentSummitId}/events/${row.id}/materials/${m.id}`,
"_blank"
);
return false;
@@ -1238,7 +1243,8 @@ class SummitEventListPage extends React.Component {
const showColumns = fieldNames(
currentSummit.selection_plans,
currentSummit.tracks,
- currentSummit.event_types
+ currentSummit.event_types,
+ currentSummit.id
)
.filter(
(f) =>