Clear typing indicator after receiving edits

This commit is contained in:
Fedor Indutny 2023-05-31 11:14:38 -07:00 committed by GitHub
parent 9c325ea724
commit 3abacb25ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 2 deletions

View file

@ -2589,6 +2589,7 @@ export async function startApp(): Promise<void> {
const editAttributes: EditAttributesType = {
conversationId: message.attributes.conversationId,
fromId: fromConversation.id,
fromDevice: data.sourceDevice ?? 1,
message: copyDataMessageIntoMessage(data.message, message.attributes),
targetSentTimestamp: editedMessageTimestamp,
};
@ -2912,6 +2913,7 @@ export async function startApp(): Promise<void> {
const editAttributes: EditAttributesType = {
conversationId: message.attributes.conversationId,
fromId: window.ConversationController.getOurConversationIdOrThrow(),
fromDevice: window.storage.user.getDeviceId() ?? 1,
message: copyDataMessageIntoMessage(data.message, message.attributes),
targetSentTimestamp: editedMessageTimestamp,
};

View file

@ -14,6 +14,7 @@ import { getMessageSentTimestamp } from '../util/getMessageSentTimestamp';
export type EditAttributesType = {
conversationId: string;
fromId: string;
fromDevice: number;
message: MessageAttributesType;
targetSentTimestamp: number;
};

View file

@ -272,9 +272,12 @@ export async function handleEditMessage(
);
drop(mainMessageModel.getConversation()?.updateLastMessage());
// Update notifications
if (conversation) {
// Clear typing indicator
const typingToken = `${editAttributes.fromId}.${editAttributes.fromDevice}`;
conversation.clearContactTypingTimer(typingToken);
// Update notifications
if (await shouldReplyNotifyUser(mainMessageModel, conversation)) {
await conversation.notify(mainMessageModel);
}

View file

@ -198,6 +198,7 @@ export async function sendEditedMessage(
const editAttributes = {
conversationId,
fromId,
fromDevice: window.storage.user.getDeviceId() ?? 1,
message: tmpMessage,
targetSentTimestamp,
};