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

View file

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

View file

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

View file

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