Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e239bf3
feat(event-form): derive CFP reopen notification recipient rows
caseylocker Aug 24, 2026
5f48334
fix(event-form): key the speaker dedupe map by the string row key
caseylocker Aug 24, 2026
667c601
feat(event-actions): add notifySubmissionReopened thunk
caseylocker Aug 24, 2026
f088748
test(event-actions): assert translate params so the recipient-count t…
caseylocker Aug 24, 2026
ca305f5
feat(event-form): notify selected recipients about a CFP reopen window
caseylocker Aug 24, 2026
f5520a0
fix(event-form): gate notify-send button on the actual sendable selec…
caseylocker Aug 24, 2026
d27bb42
fix(event-form): fix merged recipient names and stale notify payload
caseylocker Aug 24, 2026
8de08a3
fix(event-form): intersect pre/post-dialog notify selections
caseylocker Aug 24, 2026
2c99229
chore(event-form): convention pass on notify recipients
caseylocker Aug 24, 2026
f1a7386
fix(i18n): use recipient(s) in the notify confirm title
caseylocker Aug 24, 2026
08e8fdc
fix(event-form): derive notify rows from persisted entity
caseylocker Aug 24, 2026
75beb7d
fix(event-form): restore empty-notify-payload guard
caseylocker Aug 24, 2026
71bd1f3
fix(event-form): separate recipient name from roles with a dash
caseylocker Aug 24, 2026
38ea895
style(event-form): space notify recipient rows and send button
caseylocker Aug 24, 2026
3e209c3
chore(event-form): drop dupe comment, vacuous test, and a rotting rat…
caseylocker Aug 24, 2026
8f4c952
chore(event-form): convention pass on notify tail
caseylocker Aug 24, 2026
1b7ace9
refactor(event-form): address review, extract notify panel and trim t…
caseylocker Aug 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions src/actions/__tests__/event-actions-notify.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import configureStore from "redux-mock-store";
import thunk from "redux-thunk";
import { putRequest } from "openstack-uicore-foundation/lib/utils/actions";
import T from "i18n-react/dist/i18n-react";
import * as methods from "../../utils/methods";
import { notifySubmissionReopened } from "../event-actions";

jest.mock("i18n-react/dist/i18n-react", () => ({
__esModule: true,
default: { translate: jest.fn((key) => key) }
}));

jest.mock("openstack-uicore-foundation/lib/utils/actions", () => ({
__esModule: true,
...jest.requireActual("openstack-uicore-foundation/lib/utils/actions"),
putRequest: jest.fn()
}));

const mockStore = configureStore([thunk]);

describe("notifySubmissionReopened", () => {
const summitId = 5;
let store;

beforeEach(() => {
jest.clearAllMocks();
window.API_BASE_URL = "https://api.test";
store = mockStore({
currentSummitState: { currentSummit: { id: summitId } }
});
jest.spyOn(methods, "getAccessTokenSafely").mockResolvedValue("TOKEN");
});

const arrangeRequest = (
result = Promise.resolve({ response: { recipients: 3 } })
) => {
putRequest.mockReturnValue(() => () => result);
};

it("PUTs the selection to the notify endpoint in the API's snake_case shape", async () => {
arrangeRequest();

await store.dispatch(
notifySubmissionReopened(42, {
speakerIds: [7, 12],
includeSubmitter: true
})
);

expect(putRequest).toHaveBeenCalledTimes(1);
const [requestAction, , url, body] = putRequest.mock.calls[0];
expect(requestAction).toBeNull();
expect(url).toBe(
`https://api.test/api/v1/summits/${summitId}/presentations/42/submission-period/reopen/notify`
);
expect(body).toEqual({ speaker_ids: [7, 12], include_submitter: true });
});

it("reports the recipient count from the response, not a client tally", async () => {
arrangeRequest(Promise.resolve({ response: { recipients: 3 } }));

await store.dispatch(
notifySubmissionReopened(42, { speakerIds: [7], includeSubmitter: false })
);

expect(T.translate).toHaveBeenCalledWith(
"edit_event.notify_speakers_success",
{ count: 3 }
);

const snackbar = store
.getActions()
.find((a) => a.type === "SET_SNACKBAR_MESSAGE");
expect(snackbar).toBeDefined();
expect(snackbar.payload.type).toBe("success");
});

it("stops loading even when the request rejects", async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please lets only have meaningful tests

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cut from 37 to 19. Gone: the ordering assertion on startLoading, tests for inputs the API cannot produce (speaker ids are serialised as ints), render tests that re-asserted row-model behaviour already covered at the unit level, and four that only reached their state by calling rerender directly, which bypasses the page's if (loading) return null. That gate also meant the post-confirm intersection could never narrow anything in the running app, so that code is gone too, along with its tests.

Kept the one you flagged here. The thunk's .finally is the only thing that clears loading on rejection, and the page renders null while loading is set, so a stuck flag blanks the page rather than leaving a spinner.

arrangeRequest(Promise.reject(new Error("412")));

await expect(
store.dispatch(
notifySubmissionReopened(42, {
speakerIds: [7],
includeSubmitter: false
})
)
).rejects.toThrow();

expect(store.getActions().map((a) => a.type)).toContain("STOP_LOADING");
});
});
35 changes: 35 additions & 0 deletions src/actions/event-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const RECEIVE_EVENT_COMMENTS = "RECEIVE_EVENT_COMMENTS";
export const CHANGE_SEARCH_TERM = "CHANGE_SEARCH_TERM";
export const SUBMISSION_PERIOD_REOPENED = "SUBMISSION_PERIOD_REOPENED";
export const SUBMISSION_PERIOD_CLOSED = "SUBMISSION_PERIOD_CLOSED";
export const SUBMISSION_REOPEN_NOTIFIED = "SUBMISSION_REOPEN_NOTIFIED";

export const ATTENDEES_EXPECTED_LEARNT = "attendees_expected_learnt";
export const ATTENDING_MEDIA = "attending_media";
Expand Down Expand Up @@ -815,6 +816,40 @@ export const closeSubmissionPeriod =
});
};

export const notifySubmissionReopened =
(eventId, { speakerIds, includeSubmitter }) =>
async (dispatch, getState) => {
const { currentSummitState } = getState();

dispatch(startLoading());

const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;

const params = { access_token: accessToken };

return putRequest(
null,
createAction(SUBMISSION_REOPEN_NOTIFIED),
`${window.API_BASE_URL}/api/v1/summits/${currentSummit.id}/presentations/${eventId}/submission-period/reopen/notify`,
{ speaker_ids: speakerIds, include_submitter: includeSubmitter },
snackbarErrorHandler
)(params)(dispatch)
.then((payload) => {
dispatch(
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("edit_event.notify_speakers_success", {
count: payload?.response?.recipients ?? 0
})
})
);
})
.finally(() => {
dispatch(stopLoading());
});
};

export const cloneEvent = (entity) => async (dispatch, getState) => {
const { currentSummitState } = getState();
const accessToken = await getAccessTokenSafely();
Expand Down
89 changes: 89 additions & 0 deletions src/components/forms/event-form/ReopenNotifyPanel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* */

import React from "react";
import PropTypes from "prop-types";
import T from "i18n-react/dist/i18n-react";
import { ROLE } from "./utils";

const ROLE_LABEL = {
[ROLE.SUBMITTER]: "edit_event.notify_role_submitter",
[ROLE.MODERATOR]: "edit_event.notify_role_moderator",
[ROLE.SPEAKER]: "edit_event.notify_role_speaker"
};

const ReopenNotifyPanel = ({
rows,
checked,
onToggle,
canNotify,
onNotify
}) => (
<div style={{ flexBasis: "100%" }}>
<label>{T.translate("edit_event.notify_recipients_label")}</label>
<div
style={{
display: "flex",
flexDirection: "column",
gap: 10,
marginTop: 10
}}
>
{rows.map((row) => (
<div className="form-check abc-checkbox" key={row.key}>
<input
type="checkbox"
id={`notify_recipient_${row.key}`}
className="form-check-input"
disabled={row.disabled}
checked={checked.includes(row.key)}
onChange={() => onToggle(row.key)}
/>
<label
className="form-check-label"
htmlFor={`notify_recipient_${row.key}`}
>
{row.name}
&nbsp;-&nbsp;
{row.roles.map((role) => T.translate(ROLE_LABEL[role])).join(", ")}
</label>
{row.disabled && (
<span>
&nbsp;
{T.translate("edit_event.notify_no_email")}
</span>
)}
</div>
))}
</div>
<button
type="button"
className="btn btn-primary"
style={{ marginTop: 10 }}
disabled={!canNotify}
onClick={onNotify}
>
{T.translate("edit_event.notify_speakers")}
</button>
</div>
);

ReopenNotifyPanel.propTypes = {
rows: PropTypes.array.isRequired,
checked: PropTypes.array.isRequired,
onToggle: PropTypes.func.isRequired,
canNotify: PropTypes.bool.isRequired,
onNotify: PropTypes.func.isRequired
};

export default ReopenNotifyPanel;
Loading
Loading