[Glitch] Fix browser notification permission request logic

Port f54ca3d08e to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
ThibG
2020-10-13 00:37:21 +02:00
committed by Thibaut Girka
parent 2eb054c07f
commit b5927301cf
14 changed files with 202 additions and 18 deletions

View File

@ -17,6 +17,8 @@ import {
NOTIFICATIONS_ENTER_CLEARING_MODE,
NOTIFICATIONS_MARK_ALL_FOR_DELETE,
NOTIFICATIONS_MARK_AS_READ,
NOTIFICATIONS_SET_BROWSER_SUPPORT,
NOTIFICATIONS_SET_BROWSER_PERMISSION,
} from 'flavours/glitch/actions/notifications';
import {
ACCOUNT_BLOCK_SUCCESS,
@ -44,6 +46,8 @@ const initialState = ImmutableMap({
isLoading: false,
cleaningMode: false,
isTabVisible: true,
browserSupport: false,
browserPermission: 'default',
// notification removal mark of new notifs loaded whilst cleaningMode is true.
markNewForDelete: false,
});
@ -275,6 +279,10 @@ export default function notifications(state = initialState, action) {
return action.timeline === 'home' ?
state.update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items) :
state;
case NOTIFICATIONS_SET_BROWSER_SUPPORT:
return state.set('browserSupport', action.value);
case NOTIFICATIONS_SET_BROWSER_PERMISSION:
return state.set('browserPermission', action.value);
case NOTIFICATION_MARK_FOR_DELETE:
return markForDelete(state, action.id, action.yes);

View File

@ -33,12 +33,12 @@ const initialState = ImmutableMap({
notifications: ImmutableMap({
alerts: ImmutableMap({
follow: true,
follow: false,
follow_request: false,
favourite: true,
reblog: true,
mention: true,
poll: true,
favourite: false,
reblog: false,
mention: false,
poll: false,
}),
quickFilter: ImmutableMap({