mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-30 23:33:42 +01:00
Merge remote-tracking branch 'upstream/main' into develop
This commit is contained in:
commit
e333716df0
1 changed files with 11 additions and 7 deletions
|
@ -162,7 +162,9 @@ const deleteByStatus = (state, statusId) => {
|
|||
|
||||
const markForDelete = (state, notificationId, yes) => {
|
||||
return state.update('items', list => list.map(item => {
|
||||
if(item.get('id') === notificationId) {
|
||||
if (item === null) {
|
||||
return null;
|
||||
} else if(item.get('id') === notificationId) {
|
||||
return item.set('markedForDelete', yes);
|
||||
} else {
|
||||
return item;
|
||||
|
@ -172,7 +174,9 @@ const markForDelete = (state, notificationId, yes) => {
|
|||
|
||||
const markAllForDelete = (state, yes) => {
|
||||
return state.update('items', list => list.map(item => {
|
||||
if(yes !== null) {
|
||||
if (item === null) {
|
||||
return null;
|
||||
} else if(yes !== null) {
|
||||
return item.set('markedForDelete', yes);
|
||||
} else {
|
||||
return item.set('markedForDelete', !item.get('markedForDelete'));
|
||||
|
@ -181,11 +185,11 @@ const markAllForDelete = (state, yes) => {
|
|||
};
|
||||
|
||||
const unmarkAllForDelete = (state) => {
|
||||
return state.update('items', list => list.map(item => item.set('markedForDelete', false)));
|
||||
return state.update('items', list => list.map(item => item === null ? item : item.set('markedForDelete', false)));
|
||||
};
|
||||
|
||||
const deleteMarkedNotifs = (state) => {
|
||||
return state.update('items', list => list.filterNot(item => item.get('markedForDelete')));
|
||||
return state.update('items', list => list.filterNot(item => item === null ? item : item.get('markedForDelete')));
|
||||
};
|
||||
|
||||
const updateMounted = (state) => {
|
||||
|
@ -249,10 +253,10 @@ export default function notifications(state = initialState, action) {
|
|||
return state.update('items', list => state.get('pendingItems').concat(list.take(40))).set('pendingItems', ImmutableList()).set('unread', 0);
|
||||
case NOTIFICATIONS_EXPAND_REQUEST:
|
||||
case NOTIFICATIONS_DELETE_MARKED_REQUEST:
|
||||
return state.set('isLoading', (nbLoading) => nbLoading + 1);
|
||||
return state.update('isLoading', (nbLoading) => nbLoading + 1);
|
||||
case NOTIFICATIONS_DELETE_MARKED_FAIL:
|
||||
case NOTIFICATIONS_EXPAND_FAIL:
|
||||
return state.set('isLoading', (nbLoading) => nbLoading - 1);
|
||||
return state.update('isLoading', (nbLoading) => nbLoading - 1);
|
||||
case NOTIFICATIONS_FILTER_SET:
|
||||
return state.set('items', ImmutableList()).set('hasMore', true);
|
||||
case NOTIFICATIONS_SCROLL_TOP:
|
||||
|
@ -287,7 +291,7 @@ export default function notifications(state = initialState, action) {
|
|||
return markForDelete(state, action.id, action.yes);
|
||||
|
||||
case NOTIFICATIONS_DELETE_MARKED_SUCCESS:
|
||||
return deleteMarkedNotifs(state).set('isLoading', (nbLoading) => nbLoading - 1);
|
||||
return deleteMarkedNotifs(state).update('isLoading', (nbLoading) => nbLoading - 1);
|
||||
|
||||
case NOTIFICATIONS_ENTER_CLEARING_MODE:
|
||||
st = state.set('cleaningMode', action.yes);
|
||||
|
|
Loading…
Reference in a new issue