Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3491315
D6398.id21409.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6398.id21409.diff
View Options
diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import t from 'tcomb';
+import { onlyOneEmojiRegex } from 'lib/shared/emojis';
import { createMediaMessageData, trimMessage } from 'lib/shared/message-utils';
import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils';
import type { Media } from 'lib/types/media-types.js';
@@ -20,11 +21,7 @@
import type { TextMessageData } from 'lib/types/messages/text';
import { threadPermissions } from 'lib/types/thread-types';
import { ServerError } from 'lib/utils/errors';
-import {
- tString,
- tShape,
- tMediaMessageMedia,
-} from 'lib/utils/validation-utils';
+import { tRegex, tShape, tMediaMessageMedia } from 'lib/utils/validation-utils';
import createMessages from '../creators/message-creator';
import { SQL } from '../database/database';
@@ -194,7 +191,7 @@
threadID: t.String,
localID: t.maybe(t.String),
targetMessageID: t.String,
- reaction: tString('👍'),
+ reaction: tRegex(onlyOneEmojiRegex),
action: t.enums.of(['add_reaction', 'remove_reaction']),
});
async function reactionMessageCreationResponder(
diff --git a/lib/shared/emojis.js b/lib/shared/emojis.js
--- a/lib/shared/emojis.js
+++ b/lib/shared/emojis.js
@@ -9,6 +9,8 @@
'could not extract innerEmojiRegex from emoji-regex.js',
);
const innerEmojiRegexString = emojiRegexMatches[1];
+
const onlyEmojiRegex: RegExp = new RegExp(`^(${innerEmojiRegexString})+$`);
+const onlyOneEmojiRegex: RegExp = new RegExp(`^(${innerEmojiRegexString})$`);
-export { onlyEmojiRegex };
+export { onlyEmojiRegex, onlyOneEmojiRegex };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:50 PM (20 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677969
Default Alt Text
D6398.id21409.diff (1 KB)
Attached To
Mode
D6398: [keyserver] change reaction type from just like emoji to any emoji
Attached
Detach File
Event Timeline
Log In to Comment