Merge pull request #825 from openedx/aansari/INF-948

refactor: update notEditable to nonEditable in notification preferences
This commit is contained in:
Awais Ansari
2023-07-11 12:21:24 +05:00
committed by GitHub
6 changed files with 11 additions and 12 deletions

View File

@@ -58,7 +58,7 @@ const defaultPreferences = {
mobile: false,
},
],
notEditable: {},
nonEditable: {},
};
const setupStore = (override = {}) => {

View File

@@ -17,7 +17,7 @@ export const defaultState = {
selectedCourse: null,
preferences: [],
apps: [],
notEditable: {},
nonEditable: {},
},
};
@@ -59,7 +59,7 @@ const notificationPreferencesReducer = (state = defaultState, action = {}) => {
status: LOADING_STATUS,
preferences: [],
apps: [],
notEditable: {},
nonEditable: {},
},
};
case Actions.FETCHED_PREFERENCES:
@@ -79,7 +79,7 @@ const notificationPreferencesReducer = (state = defaultState, action = {}) => {
status: FAILURE_STATUS,
preferences: [],
apps: [],
notEditable: {},
nonEditable: {},
},
};
case Actions.UPDATE_SELECTED_COURSE:

View File

@@ -20,7 +20,7 @@ describe('notification-preferences reducer', () => {
push: false,
mobile: false,
}],
notEditable: {},
nonEditable: {},
};
beforeEach(() => {
@@ -98,7 +98,7 @@ describe('notification-preferences reducer', () => {
selectedCourse: null,
preferences: [],
apps: [],
notEditable: {},
nonEditable: {},
});
});

View File

@@ -47,7 +47,7 @@ export const selectPreference = (appId, name) => state => (
);
export const selectPreferenceNonEditableChannels = (appId, name) => state => (
state?.notificationPreferences.preferences.notEditable[appId]?.[name] || []
state?.notificationPreferences.preferences.nonEditable[appId]?.[name] || []
);
export const selectSelectedCourseId = () => state => (

View File

@@ -45,7 +45,7 @@ const normalizePreferences = (responseData) => {
enabled: preferences[appId].enabled,
}));
const notEditable = {};
const nonEditable = {};
const preferenceList = appKeys.map(appId => {
const preferencesKeys = Object.keys(preferences[appId].notificationTypes);
const flatPreferences = preferencesKeys.map(preferenceId => (
@@ -58,8 +58,7 @@ const normalizePreferences = (responseData) => {
info: preferences[appId].notificationTypes[preferenceId].info || '',
}
));
notEditable[appId] = preferences[appId].notEditable;
nonEditable[appId] = preferences[appId].nonEditable;
return flatPreferences;
}).flat();
@@ -67,7 +66,7 @@ const normalizePreferences = (responseData) => {
const normalizedPreferences = {
apps,
preferences: preferenceList,
notEditable,
nonEditable,
};
return normalizedPreferences;
};

View File

@@ -24,8 +24,8 @@ export const messages = defineMessages({
core {Core}
newPost {New Post}
newComment {New Comment}
newResponse {New Response}
newCommentOnPost {New Comment On Post}
newResponseOnPost {New Response On Post}
newResponseOnComment {New Response On Comment}
newAssignment {New Assignment}
newGrade {New Grade}