mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 21:08:07 +01:00
[Glitch] Fix mutes and blocks not immediately cleaning up notification requests in Web UI
Port c8b9e60ec1
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
1c91b363d5
commit
43546659bf
1 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
||||||
|
|
||||||
|
import { blockAccountSuccess, muteAccountSuccess } from 'flavours/glitch/actions/accounts';
|
||||||
import {
|
import {
|
||||||
NOTIFICATION_REQUESTS_EXPAND_REQUEST,
|
NOTIFICATION_REQUESTS_EXPAND_REQUEST,
|
||||||
NOTIFICATION_REQUESTS_EXPAND_SUCCESS,
|
NOTIFICATION_REQUESTS_EXPAND_SUCCESS,
|
||||||
|
@ -51,6 +52,14 @@ const removeRequest = (state, id) => {
|
||||||
return state.update('items', list => list.filterNot(item => item.get('id') === id));
|
return state.update('items', list => list.filterNot(item => item.get('id') === id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeRequestByAccount = (state, account_id) => {
|
||||||
|
if (state.getIn(['current', 'item', 'account']) === account_id) {
|
||||||
|
state = state.setIn(['current', 'removed'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.update('items', list => list.filterNot(item => item.get('account') === account_id));
|
||||||
|
};
|
||||||
|
|
||||||
export const notificationRequestsReducer = (state = initialState, action) => {
|
export const notificationRequestsReducer = (state = initialState, action) => {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case NOTIFICATION_REQUESTS_FETCH_SUCCESS:
|
case NOTIFICATION_REQUESTS_FETCH_SUCCESS:
|
||||||
|
@ -74,6 +83,10 @@ export const notificationRequestsReducer = (state = initialState, action) => {
|
||||||
case NOTIFICATION_REQUEST_ACCEPT_REQUEST:
|
case NOTIFICATION_REQUEST_ACCEPT_REQUEST:
|
||||||
case NOTIFICATION_REQUEST_DISMISS_REQUEST:
|
case NOTIFICATION_REQUEST_DISMISS_REQUEST:
|
||||||
return removeRequest(state, action.id);
|
return removeRequest(state, action.id);
|
||||||
|
case blockAccountSuccess.type:
|
||||||
|
return removeRequestByAccount(state, action.payload.relationship.id);
|
||||||
|
case muteAccountSuccess.type:
|
||||||
|
return action.payload.relationship.muting_notifications ? removeRequestByAccount(state, action.payload.relationship.id) : state;
|
||||||
case NOTIFICATION_REQUEST_FETCH_REQUEST:
|
case NOTIFICATION_REQUEST_FETCH_REQUEST:
|
||||||
return state.set('current', initialState.get('current').set('isLoading', true));
|
return state.set('current', initialState.get('current').set('isLoading', true));
|
||||||
case NOTIFICATION_REQUEST_FETCH_SUCCESS:
|
case NOTIFICATION_REQUEST_FETCH_SUCCESS:
|
||||||
|
|
Loading…
Reference in a new issue