refactor: Rewrite immutablejs import statements using destructuring (#4147)
This commit is contained in:
parent
7bacdd718a
commit
cc68d1945b
28 changed files with 141 additions and 141 deletions
|
@ -11,10 +11,10 @@ import {
|
|||
} from '../actions/notifications';
|
||||
import { ACCOUNT_BLOCK_SUCCESS } from '../actions/accounts';
|
||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
||||
import Immutable from 'immutable';
|
||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||
|
||||
const initialState = Immutable.Map({
|
||||
items: Immutable.List(),
|
||||
const initialState = ImmutableMap({
|
||||
items: ImmutableList(),
|
||||
next: null,
|
||||
top: true,
|
||||
unread: 0,
|
||||
|
@ -22,7 +22,7 @@ const initialState = Immutable.Map({
|
|||
isLoading: true,
|
||||
});
|
||||
|
||||
const notificationToMap = notification => Immutable.Map({
|
||||
const notificationToMap = notification => ImmutableMap({
|
||||
id: notification.id,
|
||||
type: notification.type,
|
||||
account: notification.account.id,
|
||||
|
@ -46,7 +46,7 @@ const normalizeNotification = (state, notification) => {
|
|||
};
|
||||
|
||||
const normalizeNotifications = (state, notifications, next) => {
|
||||
let items = Immutable.List();
|
||||
let items = ImmutableList();
|
||||
const loaded = state.get('loaded');
|
||||
|
||||
notifications.forEach((n, i) => {
|
||||
|
@ -64,7 +64,7 @@ const normalizeNotifications = (state, notifications, next) => {
|
|||
};
|
||||
|
||||
const appendNormalizedNotifications = (state, notifications, next) => {
|
||||
let items = Immutable.List();
|
||||
let items = ImmutableList();
|
||||
|
||||
notifications.forEach((n, i) => {
|
||||
items = items.set(i, notificationToMap(n));
|
||||
|
@ -110,7 +110,7 @@ export default function notifications(state = initialState, action) {
|
|||
case ACCOUNT_BLOCK_SUCCESS:
|
||||
return filterNotifications(state, action.relationship);
|
||||
case NOTIFICATIONS_CLEAR:
|
||||
return state.set('items', Immutable.List()).set('next', null);
|
||||
return state.set('items', ImmutableList()).set('next', null);
|
||||
case TIMELINE_DELETE:
|
||||
return deleteByStatus(state, action.id);
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue