fix: repaired reaction notifications for 1-1s

pull/2454/head
William Grant 3 years ago
parent dde61bb35b
commit f309bf40f8

@ -22,6 +22,7 @@ import { appendFetchAvatarAndProfileJob } from './userProfileImageUpdates';
import { toLogFormat } from '../types/attachments/Errors'; import { toLogFormat } from '../types/attachments/Errors';
import { ConversationTypeEnum } from '../models/conversationAttributes'; import { ConversationTypeEnum } from '../models/conversationAttributes';
import { handleMessageReaction } from '../util/reactions'; import { handleMessageReaction } from '../util/reactions';
import { Action, Reaction } from '../types/Reaction';
function cleanAttachment(attachment: any) { function cleanAttachment(attachment: any) {
return { return {
@ -326,6 +327,15 @@ async function handleSwarmMessage(
msgModel.get('source'), msgModel.get('source'),
isUsFromCache(msgModel.get('source')) isUsFromCache(msgModel.get('source'))
); );
if (
convoToAddMessageTo.isPrivate() &&
msgModel.get('unread') &&
rawDataMessage.reaction.action === Action.REACT
) {
msgModel.set('reaction', rawDataMessage.reaction as Reaction);
convoToAddMessageTo.throttledNotify(msgModel);
}
confirm(); confirm();
return; return;
} }

@ -16,7 +16,6 @@ import { GoogleChrome } from '../util';
import { appendFetchAvatarAndProfileJob } from './userProfileImageUpdates'; import { appendFetchAvatarAndProfileJob } from './userProfileImageUpdates';
import { ConversationTypeEnum } from '../models/conversationAttributes'; import { ConversationTypeEnum } from '../models/conversationAttributes';
import { getUsBlindedInThatServer } from '../session/apis/open_group_api/sogsv3/knownBlindedkeys'; import { getUsBlindedInThatServer } from '../session/apis/open_group_api/sogsv3/knownBlindedkeys';
import { Action, Reaction } from '../types/Reaction';
function contentTypeSupported(type: string): boolean { function contentTypeSupported(type: string): boolean {
const Chrome = GoogleChrome; const Chrome = GoogleChrome;
@ -339,18 +338,6 @@ export async function handleMessageJob(
) || messageModel.get('timestamp')} in conversation ${conversation.idForLogging()}` ) || messageModel.get('timestamp')} in conversation ${conversation.idForLogging()}`
); );
if (!messageModel.get('isPublic') && regularDataMessage.reaction) {
if (
regularDataMessage.reaction.action === Action.REACT &&
conversation.isPrivate() &&
messageModel.get('unread')
) {
messageModel.set('reaction', regularDataMessage.reaction as Reaction);
conversation.throttledNotify(messageModel);
}
confirm?.();
} else {
const sendingDeviceConversation = await getConversationController().getOrCreateAndWait( const sendingDeviceConversation = await getConversationController().getOrCreateAndWait(
source, source,
ConversationTypeEnum.PRIVATE ConversationTypeEnum.PRIVATE
@ -451,4 +438,3 @@ export async function handleMessageJob(
window?.log?.error('handleMessageJob', messageModel.idForLogging(), 'error:', errorForLog); window?.log?.error('handleMessageJob', messageModel.idForLogging(), 'error:', errorForLog);
} }
} }
}

@ -125,10 +125,11 @@ export const sendMessageReaction = async (messageId: string, emoji: string) => {
emoji, emoji,
'reaction for message', 'reaction for message',
id, id,
found.get('isPublic') && found.get('isPublic')
`on ${conversationModel.toOpenGroupV2().serverUrl}/${ ? `on ${conversationModel.toOpenGroupV2().serverUrl}/${
conversationModel.toOpenGroupV2().roomId conversationModel.toOpenGroupV2().roomId
}` }`
: ''
); );
return reaction; return reaction;
} else { } else {

Loading…
Cancel
Save