[Gekidou MM-3972] Websocket Events - Reaction and emojis (#5920)

* Wip

* update name so it references changing the reaction on a post

* handleAddEmoji -> handleAddCustomEmoji

* add remove reaction logic

* sanitizeReactions
  * use skipSync to return early if not deleting any records that are
    not in the server db
  * return the filtered delete results and have the handler destroy the
    records

* fix lint

* use forEach instead of map.

* PR feedback

* PR feedback

* Update app/actions/websocket/reactions.ts

* remove console.log

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Jason Frerich
2022-02-03 04:14:08 -06:00
committed by GitHub
parent 4e8d655167
commit f815f6b3e5
5 changed files with 82 additions and 6 deletions

View File

@@ -152,6 +152,7 @@ const UserHandler = (superclass: any) => class extends superclass {
database: this.database,
post_id,
rawReactions: rawValues,
skipSync,
});
if (createReactions?.length) {
@@ -165,6 +166,7 @@ const UserHandler = (superclass: any) => class extends superclass {
}
if (deleteReactions?.length && !skipSync) {
deleteReactions.forEach((outCast) => outCast.prepareDestroyPermanently());
batchRecords.push(...deleteReactions);
}
}