Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3380765
D5878.id19686.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
791 B
Referenced Files
None
Subscribers
None
D5878.id19686.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 1:58 AM (20 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595431
Default Alt Text
D5878.id19686.diff (791 B)
Attached To
Mode
D5878: [lib] introduce stringForReactionList in reaction-utils
Attached
Detach File
Event Timeline
Log In to Comment