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 @@ -32,6 +32,7 @@ fetchMessageInfoForLocalID, fetchMessageInfoByID, } from '../fetchers/message-fetchers'; +import { fetchServerThreadInfos } from '../fetchers/thread-fetchers'; import { checkThreadPermission } from '../fetchers/thread-permission-fetchers'; import { fetchMedia, @@ -213,11 +214,21 @@ throw new ServerError('invalid_parameters'); } - const [hasPermission, targetMessageUserInfos] = await Promise.all([ + const [ + serverThreadInfos, + hasPermission, + targetMessageUserInfos, + ] = await Promise.all([ + fetchServerThreadInfos(), checkThreadPermission(viewer, threadID, threadPermissions.VOICED), fetchKnownUserInfos(viewer, [targetMessageInfo.creatorID]), ]); + const targetMessageThreadInfo = serverThreadInfos.threadInfos[threadID]; + if (targetMessageThreadInfo.sourceMessageID === targetMessageID) { + throw new ServerError('invalid_parameters'); + } + const targetMessageCreator = targetMessageUserInfos[targetMessageInfo.creatorID]; diff --git a/native/chat/reaction-message-utils.js b/native/chat/reaction-message-utils.js --- a/native/chat/reaction-message-utils.js +++ b/native/chat/reaction-message-utils.js @@ -102,7 +102,10 @@ ?.relationshipStatus, ); - if (!targetMessageInfo.id) { + if ( + !targetMessageInfo.id || + threadInfo.sourceMessageID === targetMessageInfo.id + ) { return false; }