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:
commit
6be0b61569
14 changed files with 21 additions and 1 deletions
BIN
app/soapbox/normalizers/__tests__/notification-test.js
Normal file
BIN
app/soapbox/normalizers/__tests__/notification-test.js
Normal file
Binary file not shown.
Binary file not shown.
20
app/soapbox/normalizers/notification.ts
Normal file
20
app/soapbox/normalizers/notification.ts
Normal 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);
|
||||
};
|
|
@ -11,7 +11,7 @@ import { IStatus } from 'soapbox/types';
|
|||
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||
|
||||
const StatusRecord = ImmutableRecord({
|
||||
account: ImmutableMap(),
|
||||
account: null,
|
||||
application: null,
|
||||
bookmarked: false,
|
||||
card: null,
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue