sforkowany z mirror/soapbox
Chats: add pleroma:chat_mention to push types
rodzic
f305b2e98e
commit
1fca260dd2
|
@ -11,6 +11,7 @@ describe('push_notifications reducer', () => {
|
|||
reblog: false,
|
||||
mention: false,
|
||||
poll: false,
|
||||
'pleroma:chat_mention': false,
|
||||
}),
|
||||
isSubscribed: false,
|
||||
browserSupport: false,
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { STORE_HYDRATE } from '../actions/store';
|
||||
import { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, SET_ALERTS } from '../actions/push_notifications';
|
||||
import Immutable from 'immutable';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
const initialState = Immutable.Map({
|
||||
const initialState = ImmutableMap({
|
||||
subscription: null,
|
||||
alerts: new Immutable.Map({
|
||||
alerts: ImmutableMap({
|
||||
follow: false,
|
||||
favourite: false,
|
||||
reblog: false,
|
||||
mention: false,
|
||||
poll: false,
|
||||
'pleroma:chat_mention': false,
|
||||
}),
|
||||
isSubscribed: false,
|
||||
browserSupport: false,
|
||||
|
@ -17,28 +17,10 @@ const initialState = Immutable.Map({
|
|||
|
||||
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('subscription', ImmutableMap(action.subscription))
|
||||
.set('alerts', ImmutableMap(action.subscription.alerts))
|
||||
.set('isSubscribed', true);
|
||||
case SET_BROWSER_SUPPORT:
|
||||
return state.set('browserSupport', action.value);
|
||||
|
|
Ładowanie…
Reference in New Issue