mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-25 09:34:16 -05:00
911cc14481
* Add follow_request notification type The notification type already existed in the backend but was never pushed to the front-end. This also means translation strings were also available for the backend, from the notification mailer. Unlike other notification types, these are off by default, to match what I remember of Gargron's view on the topic: that follow requests should not clutter notifications and should instead be reviewed at the user's own leisure in the dedicated column. Since follow requests have their own column, I've deemed it unnecessary to add a specific tab for them in the notification quick filter. * Show follow request link in single-column if there are pending requests, even if account isn't locked * Push follow requests from notifications to the follow_requests list * Offer to accept or reject follow request from the notification * Redesign follow request notification
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
import { STORE_HYDRATE } from '../actions/store';
|
|
import { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, SET_ALERTS } from '../actions/push_notifications';
|
|
import Immutable from 'immutable';
|
|
|
|
const initialState = Immutable.Map({
|
|
subscription: null,
|
|
alerts: new Immutable.Map({
|
|
follow: false,
|
|
follow_request: false,
|
|
favourite: false,
|
|
reblog: false,
|
|
mention: false,
|
|
poll: false,
|
|
}),
|
|
isSubscribed: false,
|
|
browserSupport: false,
|
|
});
|
|
|
|
export default function push_subscriptions(state = initialState, action) {
|
|
switch(action.type) {
|
|
case STORE_HYDRATE: {
|
|
const push_subscription = action.state.get('push_subscription');
|
|
|
|
if (push_subscription) {
|
|
return state
|
|
.set('subscription', new Immutable.Map({
|
|
id: push_subscription.get('id'),
|
|
endpoint: push_subscription.get('endpoint'),
|
|
}))
|
|
.set('alerts', push_subscription.get('alerts') || initialState.get('alerts'))
|
|
.set('isSubscribed', true);
|
|
}
|
|
|
|
return state;
|
|
}
|
|
case SET_SUBSCRIPTION:
|
|
return state
|
|
.set('subscription', new Immutable.Map({
|
|
id: action.subscription.id,
|
|
endpoint: action.subscription.endpoint,
|
|
}))
|
|
.set('alerts', new Immutable.Map(action.subscription.alerts))
|
|
.set('isSubscribed', true);
|
|
case SET_BROWSER_SUPPORT:
|
|
return state.set('browserSupport', action.value);
|
|
case CLEAR_SUBSCRIPTION:
|
|
return initialState;
|
|
case SET_ALERTS:
|
|
return state.setIn(action.path, action.value);
|
|
default:
|
|
return state;
|
|
}
|
|
};
|