From 37827c34d9140af72dd09e47f72c21d465da74b4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 11 Mar 2022 12:13:36 -0600 Subject: [PATCH] Create Notification normalizer --- .../__tests__/notification-test.js | Bin 0 -> 554 bytes app/soapbox/normalizers/notification.ts | 20 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/soapbox/normalizers/__tests__/notification-test.js create mode 100644 app/soapbox/normalizers/notification.ts diff --git a/app/soapbox/normalizers/__tests__/notification-test.js b/app/soapbox/normalizers/__tests__/notification-test.js new file mode 100644 index 0000000000000000000000000000000000000000..c90b5451efcbfcec4948be16e9fcd2cec128739a GIT binary patch literal 554 zcmaiw&rZWI42SQ13g41SQ+R-B9FRD`fdf2&mwL!j{*gEmquRUEt}QB1X@^Kr{Cz(= zW}jjf=;4)Y%pG8XC-1A^(b4p@gHw+F`3)}D3n*UdYTq=x_#tMGj=$(73ZK}ba11|= zF?V70KAIgBoB2puZK}FeJJ2m0?xAl0SXNvC3_w1~89b(69Dt3X2&}uoVg7>dFYSH^ zTcAv(IvL8_6Ra}^?<&$~A}jjOjtrM+S$c|WTO;v-wB$;2$61`}M$U;w=JBJV(@JeZ gXl<-P=B!Yi+r$L(JKdy;pwx0Ji@SeQjVl|^H(&+1umAu6 literal 0 HcmV?d00001 diff --git a/app/soapbox/normalizers/notification.ts b/app/soapbox/normalizers/notification.ts new file mode 100644 index 0000000000..ab369a52b2 --- /dev/null +++ b/app/soapbox/normalizers/notification.ts @@ -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) => { + return NotificationRecord(notification); +};