Receive support for editing messages
This commit is contained in:
parent
2781e621ad
commit
36e21c0134
46 changed files with 2053 additions and 405 deletions
28
ts/util/getQuoteBodyText.ts
Normal file
28
ts/util/getQuoteBodyText.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { MessageAttributesType } from '../model-types.d';
|
||||
import * as EmbeddedContact from '../types/EmbeddedContact';
|
||||
|
||||
export function getQuoteBodyText(
|
||||
messageAttributes: MessageAttributesType,
|
||||
id: number
|
||||
): string | undefined {
|
||||
const storyReactionEmoji = messageAttributes.storyReaction?.emoji;
|
||||
|
||||
const { editHistory } = messageAttributes;
|
||||
const editedMessage =
|
||||
editHistory && editHistory.find(edit => edit.timestamp === id);
|
||||
|
||||
if (editedMessage && editedMessage.body) {
|
||||
return editedMessage.body;
|
||||
}
|
||||
|
||||
const { body, contact: embeddedContact } = messageAttributes;
|
||||
const embeddedContactName =
|
||||
embeddedContact && embeddedContact.length > 0
|
||||
? EmbeddedContact.getName(embeddedContact[0])
|
||||
: '';
|
||||
|
||||
return body || embeddedContactName || storyReactionEmoji;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue