Merge branch 'reducer-records' into 'develop'

Refactor some reducers with Immutable.Record

See merge request soapbox-pub/soapbox-fe!1093
This commit is contained in:
Alex Gleason 2022-03-11 21:01:15 +00:00
commit 6be0b61569
14 changed files with 21 additions and 1 deletions

Binary file not shown.

View file

@ -0,0 +1,20 @@
import {
Map as ImmutableMap,
Record as ImmutableRecord,
} from 'immutable';
// https://docs.joinmastodon.org/entities/notification/
const NotificationRecord = ImmutableRecord({
account: null,
chat_message: null, // pleroma:chat_mention
created_at: new Date(),
emoji: null, // pleroma:emoji_reaction
id: '',
status: null,
target: null, // move
type: '',
});
export const normalizeNotification = (notification: ImmutableMap<string, any>) => {
return NotificationRecord(notification);
};

View file

@ -11,7 +11,7 @@ import { IStatus } from 'soapbox/types';
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers'; import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
const StatusRecord = ImmutableRecord({ const StatusRecord = ImmutableRecord({
account: ImmutableMap(), account: null,
application: null, application: null,
bookmarked: false, bookmarked: false,
card: null, card: null,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.