Skip to content

Remove notifications system #3015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 0 additions & 16 deletions src/commons/application/actions/SessionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import { Role, StoriesRole } from '../ApplicationTypes';
import {
AdminPanelCourseRegistration,
CourseRegistration,
NotificationConfiguration,
NotificationPreference,
TimeOption,
Tokens,
UpdateCourseConfiguration,
User
Expand Down Expand Up @@ -74,9 +71,6 @@ const SessionActions = createActions('session', {
setCourseRegistration: (courseRegistration: Partial<CourseRegistration>) => courseRegistration,
setAssessmentConfigurations: (assessmentConfigurations: AssessmentConfiguration[]) =>
assessmentConfigurations,
setConfigurableNotificationConfigs: (notificationConfigs: NotificationConfiguration[]) =>
notificationConfigs,
setNotificationConfigs: (notificationConfigs: NotificationConfiguration[]) => notificationConfigs,
setAdminPanelCourseRegistrations: (courseRegistrations: AdminPanelCourseRegistration[]) =>
courseRegistrations,
setGoogleUser: (user?: string) => user,
Expand Down Expand Up @@ -141,18 +135,8 @@ const SessionActions = createActions('session', {
updateCourseConfig: (courseConfiguration: UpdateCourseConfiguration) => courseConfiguration,
fetchAssessmentConfigs: () => ({}),
updateAssessmentConfigs: (assessmentConfigs: AssessmentConfiguration[]) => assessmentConfigs,
updateNotificationConfigs: (notificationConfigs: NotificationConfiguration[]) =>
notificationConfigs,
updateNotificationPreferences: (
notificationPreferences: NotificationPreference[],
courseRegId: number
) => ({ notificationPreferences, courseRegId }),
deleteAssessmentConfig: (assessmentConfig: AssessmentConfiguration) => assessmentConfig,
fetchAdminPanelCourseRegistrations: () => ({}),
fetchConfigurableNotificationConfigs: (courseRegId: number) => ({ courseRegId }),
fetchNotificationConfigs: () => ({}),
updateTimeOptions: (timeOptions: TimeOption[]) => timeOptions,
deleteTimeOptions: (timeOptionIds: number[]) => timeOptionIds,
updateUserRole: (courseRegId: number, role: Role) => ({ courseRegId, role }),
deleteUserCourseRegistration: (courseRegId: number) => ({ courseRegId }),
updateCourseResearchAgreement: (agreedToResearch: boolean) => ({ agreedToResearch }),
Expand Down
6 changes: 0 additions & 6 deletions src/commons/application/reducers/SessionsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ const newSessionsReducer = createReducer(defaultSession, builder => {
.addCase(SessionActions.setAssessmentConfigurations, (state, action) => {
state.assessmentConfigurations = action.payload;
})
.addCase(SessionActions.setNotificationConfigs, (state, action) => {
state.notificationConfigs = action.payload;
})
.addCase(SessionActions.setConfigurableNotificationConfigs, (state, action) => {
state.configurableNotificationConfigs = action.payload;
})
.addCase(SessionActions.setAdminPanelCourseRegistrations, (state, action) => {
state.userCourseRegistrations = action.payload;
})
Expand Down
35 changes: 0 additions & 35 deletions src/commons/application/types/SessionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export type SessionState = {
readonly assessmentConfigurations?: AssessmentConfiguration[];
readonly userCourseRegistrations?: AdminPanelCourseRegistration[];

readonly notificationConfigs?: NotificationConfiguration[];
readonly configurableNotificationConfigs?: NotificationConfiguration[];

// For research data collection
readonly agreedToResearch?: boolean | null;
readonly sessionId: number;
Expand Down Expand Up @@ -124,35 +121,3 @@ export type AdminPanelCourseRegistration = {
};

export type UpdateCourseConfiguration = Partial<CourseConfiguration>;

export type TimeOption = {
id: number;
isDefault: boolean;
minutes: number;
notificationConfigId?: number;
};

export type NotificationPreference = {
id: number;
isEnabled: boolean | null;
timeOptionId: number | null;
notificationConfigId?: number;
};

export type NotificationConfiguration = {
id: number;
isEnabled: boolean;
notificationType: {
id: number;
name: string;
isEnabled: boolean;
forStaff: boolean;
};
timeOptions: TimeOption[];
assessmentConfig: {
id: number;
type: string;
} | null;
notificationPreference: NotificationPreference;
course: any;
};
11 changes: 1 addition & 10 deletions src/commons/navigationBar/subcomponents/AcademyNavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ export const getAcademyNavbarRightInfo = ({
isEnrolledInACourse: boolean;
courseId?: number;
role?: Role;
}): NavbarEntryInfo[] => [
...getStaffNavlinkInfo({ courseId, role }),
{
to: `/courses/${courseId}/notipreference`,
icon: IconNames.NOTIFICATIONS,
text: 'Notifications',
disabled: !isEnrolledInACourse,
hiddenInBreakpoints: ['xs', 'sm', 'md', 'lg']
}
];
}): NavbarEntryInfo[] => [...getStaffNavlinkInfo({ courseId, role })];

export default AcademyNavigationBar;
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,6 @@ exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Gr
text="Admin Panel"
to="/courses/0/adminpanel"
/>
<DesktopNavLink
disabled={false}
hiddenInBreakpoints={
Array [
"xs",
"sm",
"md",
"lg",
]
}
icon="notifications"
text="Notifications"
to="/courses/0/notipreference"
/>
</Blueprint5.NavbarGroup>
</Blueprint5.Navbar>
`;
Expand Down Expand Up @@ -352,20 +338,6 @@ exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Gr
text="Admin Panel"
to="/courses/0/adminpanel"
/>
<DesktopNavLink
disabled={false}
hiddenInBreakpoints={
Array [
"xs",
"sm",
"md",
"lg",
]
}
icon="notifications"
text="Notifications"
to="/courses/0/notipreference"
/>
</Blueprint5.NavbarGroup>
</Blueprint5.Navbar>
`;
Expand Down Expand Up @@ -537,20 +509,6 @@ exports[`MissionControl, GroundControl, Sourcereel, GameSimulator, Dashboard, Te
text="Admin Panel"
to="/courses/0/adminpanel"
/>
<DesktopNavLink
disabled={false}
hiddenInBreakpoints={
Array [
"xs",
"sm",
"md",
"lg",
]
}
icon="notifications"
text="Notifications"
to="/courses/0/notipreference"
/>
</Blueprint5.NavbarGroup>
</Blueprint5.Navbar>
`;
87 changes: 0 additions & 87 deletions src/commons/sagas/BackendSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
AdminPanelCourseRegistration,
CourseConfiguration,
CourseRegistration,
NotificationConfiguration,
TimeOption,
Tokens,
UpdateCourseConfiguration,
User
Expand Down Expand Up @@ -60,13 +58,11 @@ import {
getAssessment,
getAssessmentConfigs,
getAssessmentOverviews,
getConfigurableNotificationConfigs,
getCourseConfig,
getGrading,
getGradingOverviews,
getGradingSummary,
getLatestCourseRegistrationAndConfiguration,
getNotificationConfigs,
getNotifications,
getSourcecastIndex,
getStudents,
Expand Down Expand Up @@ -95,13 +91,9 @@ import {
putCourseResearchAgreement,
putLatestViewedCourse,
putNewUsers,
putNotificationConfigs,
putNotificationPreferences,
putTeams,
putTimeOptions,
putUserRole,
removeAssessmentConfig,
removeTimeOptions,
removeUserCourseRegistration,
unpublishGrading,
unpublishGradingAll,
Expand Down Expand Up @@ -859,32 +851,6 @@ const newBackendSagaTwo = combineSagaHandlers(sagaActions, {
yield put(actions.setAssessmentConfigurations(assessmentConfigs));
}
},
fetchConfigurableNotificationConfigs: function* (action) {
const tokens: Tokens = yield selectTokens();
const { courseRegId }: { courseRegId: number } = action.payload;

const notificationConfigs: NotificationConfiguration[] | null = yield call(
getConfigurableNotificationConfigs,
tokens,
courseRegId
);

if (notificationConfigs) {
yield put(actions.setConfigurableNotificationConfigs(notificationConfigs));
}
},
fetchNotificationConfigs: function* () {
const tokens: Tokens = yield selectTokens();

const notificationConfigs: NotificationConfiguration[] | null = yield call(
getNotificationConfigs,
tokens
);

if (notificationConfigs) {
yield put(actions.setNotificationConfigs(notificationConfigs));
}
},
updateAssessmentConfigs: function* (action) {
const tokens: Tokens = yield selectTokens();
const assessmentConfigs: AssessmentConfiguration[] = action.payload;
Expand All @@ -904,41 +870,6 @@ const newBackendSagaTwo = combineSagaHandlers(sagaActions, {
}
yield call(showSuccessMessage, 'Updated successfully!', 1000);
},
updateNotificationConfigs: function* (action) {
const tokens: Tokens = yield selectTokens();
const notificationConfigs: NotificationConfiguration[] = action.payload;

const resp: Response | null = yield call(putNotificationConfigs, tokens, notificationConfigs);
if (!resp || !resp.ok) {
return yield handleResponseError(resp);
}

const updatedNotificationConfigs: NotificationConfiguration[] | null = yield call(
getNotificationConfigs,
tokens
);

if (updatedNotificationConfigs) {
yield put(actions.setNotificationConfigs(updatedNotificationConfigs));
}

yield call(showSuccessMessage, 'Updated successfully!', 1000);
},
updateNotificationPreferences: function* (action) {
const tokens: Tokens = yield selectTokens();
const { notificationPreferences, courseRegId } = action.payload;
const resp: Response | null = yield call(
putNotificationPreferences,
tokens,
notificationPreferences,
courseRegId
);
if (!resp || !resp.ok) {
return yield handleResponseError(resp);
}

yield call(showSuccessMessage, 'Updated successfully!', 1000);
},
deleteAssessmentConfig: function* (action) {
const tokens: Tokens = yield selectTokens();
const assessmentConfig: AssessmentConfiguration = action.payload;
Expand All @@ -948,24 +879,6 @@ const newBackendSagaTwo = combineSagaHandlers(sagaActions, {
return yield handleResponseError(resp);
}
},
updateTimeOptions: function* (action) {
const tokens: Tokens = yield selectTokens();
const timeOptions: TimeOption[] = action.payload;

const resp: Response | null = yield call(putTimeOptions, tokens, timeOptions);
if (!resp || !resp.ok) {
return yield handleResponseError(resp);
}
},
deleteTimeOptions: function* (action) {
const tokens: Tokens = yield selectTokens();
const timeOptionIds: number[] = action.payload;

const resp: Response | null = yield call(removeTimeOptions, tokens, timeOptionIds);
if (!resp || !resp.ok) {
return yield handleResponseError(resp);
}
},
fetchAdminPanelCourseRegistrations: function* (action) {
const tokens: Tokens = yield selectTokens();

Expand Down
Loading
Loading