From ecf59d30c55181b25493c170819d2bb223ef28ba Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 5 Apr 2022 19:58:34 +1000 Subject: User Notes (#707) * Notes implementation. Bug: Client does not save note locally after uploading to server. Client does save after reloading page. Is this due to the response being sent by PUT? * I don't know why the client doesn't do optimistic UI updates with this, or any updates at all without reloading the page * Added USER_NOTE_UPDATE event, thanks @TheRealGeoDash2019 ! --- util/src/entities/User.ts | 4 ++++ util/src/interfaces/Event.ts | 1 + 2 files changed, 5 insertions(+) (limited to 'util/src') diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index ed7bd4ce..7091ee24 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -164,6 +164,9 @@ export class User extends BaseClass { @Column({ type: "simple-json", select: false }) settings: UserSettings; + @Column({ type: "simple-json" }) + notes: { [key: string]: string }; //key is ID of user + toPublicUser() { const user: any = {}; PublicUserProjection.forEach((x) => { @@ -271,6 +274,7 @@ export class User extends BaseClass { }, settings: { ...defaultSettings, locale: language }, fingerprints: [], + notes: {}, }); await user.save(); diff --git a/util/src/interfaces/Event.ts b/util/src/interfaces/Event.ts index a5253c09..416082ed 100644 --- a/util/src/interfaces/Event.ts +++ b/util/src/interfaces/Event.ts @@ -623,6 +623,7 @@ export type EVENT = | "PRESENCE_UPDATE" | "TYPING_START" | "USER_UPDATE" + | "USER_NOTE_UPDATE" | "WEBHOOKS_UPDATE" | "INTERACTION_CREATE" | "VOICE_STATE_UPDATE" -- cgit 1.5.1