Skip to content

Commit

Permalink
fix(unsubscribe): update notices on an unsubscribe event from content
Browse files Browse the repository at this point in the history
  • Loading branch information
lutangar committed Jan 30, 2020
1 parent 0a1c00f commit f3d6d59
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/content/reducers/notices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LOCATION_CHANGE } from 'connected-react-router';
import * as R from 'ramda';
import {
dislikeNotice,
dismissNotice,
Expand All @@ -17,13 +18,21 @@ import {
NOTICES_FOUND,
NO_NOTICES_DISPLAYED,
CONTEXT_NOT_TRIGGERED,
AppAction
AppAction,
UNSUBSCRIBE
} from 'app/actions';
import { getContributorId } from 'app/background/reducers/subscriptions.reducer';

export type NoticesState = StatefulNotice[];

export default (state: NoticesState = [], action: AppAction): NoticesState => {
switch (action.type) {
case UNSUBSCRIBE:
return R.reject(
R.pathEq(['contributor', 'id'], getContributorId(action)),
state
);

case NOTICES_FOUND:
return action.payload.notices;

Expand Down

0 comments on commit f3d6d59

Please sign in to comment.