Page MenuHomePhabricator

D5878.id19917.diff
No OneTemporary

D5878.id19917.diff

diff --git a/lib/shared/reaction-utils.js b/lib/shared/reaction-utils.js
new file mode 100644
--- /dev/null
+++ b/lib/shared/reaction-utils.js
@@ -0,0 +1,25 @@
+// @flow
+
+import invariant from 'invariant';
+
+import type { MessageReactionInfo } from '../selectors/chat-selectors';
+
+function stringForReactionList(
+ reactions: $ReadOnlyMap<string, MessageReactionInfo>,
+): string {
+ const reactionText = [];
+
+ for (const reaction of reactions.keys()) {
+ const reactionInfo = reactions.get(reaction);
+ invariant(reactionInfo, 'reactionInfo should be set');
+
+ reactionText.push(reaction);
+ if (reactionInfo.users.size > 1) {
+ reactionText.push(reactionInfo.users.size);
+ }
+ }
+
+ return reactionText.join(' ');
+}
+
+export { stringForReactionList };

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 6:29 PM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605473
Default Alt Text
D5878.id19917.diff (791 B)

Event Timeline