Skip to content
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

fix: handle app wide channel notification preference through existing endpoint #999

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/notification-preferences/NotificationPreferenceApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
selectUpdatePreferencesStatus,
} from './data/selectors';
import NotificationPreferenceRow from './NotificationPreferenceRow';
import { updateAppPreferenceToggle, updateChannelPreferenceToggle } from './data/thunks';
import { updatePreferenceToggle } from './data/thunks';
import { LOADING_STATUS } from '../constants';
import NOTIFICATION_CHANNELS from './data/constants';

Expand All @@ -35,7 +35,7 @@
(preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference),
);

dispatch(updateChannelPreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences));
dispatch(updatePreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences));
}, [appId, appPreferences, courseId, dispatch, nonEditable]);

const preferences = useMemo(() => (
Expand All @@ -48,7 +48,7 @@
))), [appId, appPreferences]);

const onChangeAppSettings = useCallback((event) => {
dispatch(updateAppPreferenceToggle(courseId, appId, event.target.checked));

Check failure on line 51 in src/notification-preferences/NotificationPreferenceApp.jsx

View workflow job for this annotation

GitHub Actions / tests (lint)

'updateAppPreferenceToggle' is not defined
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appId]);
if (!courseId) {
Expand Down
12 changes: 0 additions & 12 deletions src/notification-preferences/data/thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
getCourseList,
getCourseNotificationPreferences,
patchAppPreferenceToggle,
patchChannelPreferenceToggle,

Check failure on line 17 in src/notification-preferences/data/thunks.js

View workflow job for this annotation

GitHub Actions / tests (lint)

'patchChannelPreferenceToggle' is defined but never used
patchPreferenceToggle,
} from './service';

Expand Down Expand Up @@ -149,15 +149,3 @@
}
}
);

export const updateChannelPreferenceToggle = (courseId, notificationApp, notificationChannel, value) => (
async (dispatch) => {
try {
const data = await patchChannelPreferenceToggle(courseId, notificationApp, notificationChannel, value);
const normalizedData = normalizePreferences(camelCaseObject(data));
dispatch(fetchNotificationPreferenceSuccess(courseId, normalizedData));
} catch (errors) {
dispatch(fetchNotificationPreferenceFailed());
}
}
);
Loading