Show quote properly when replying to 1:1 story reaction
This commit is contained in:
parent
9bbb262c8e
commit
83eccee42e
2 changed files with 14 additions and 11 deletions
|
@ -34,7 +34,6 @@ import { toDayMillis } from '../util/timestamp';
|
||||||
import { isGIF } from '../types/Attachment';
|
import { isGIF } from '../types/Attachment';
|
||||||
import type { CallHistoryDetailsType } from '../types/Calling';
|
import type { CallHistoryDetailsType } from '../types/Calling';
|
||||||
import { CallMode } from '../types/Calling';
|
import { CallMode } from '../types/Calling';
|
||||||
import * as EmbeddedContact from '../types/EmbeddedContact';
|
|
||||||
import * as Conversation from '../types/Conversation';
|
import * as Conversation from '../types/Conversation';
|
||||||
import type { StickerType, StickerWithHydratedData } from '../types/Stickers';
|
import type { StickerType, StickerWithHydratedData } from '../types/Stickers';
|
||||||
import * as Stickers from '../types/Stickers';
|
import * as Stickers from '../types/Stickers';
|
||||||
|
@ -3847,20 +3846,12 @@ export class ConversationModel extends window.Backbone
|
||||||
}
|
}
|
||||||
|
|
||||||
async makeQuote(quotedMessage: MessageModel): Promise<QuotedMessageType> {
|
async makeQuote(quotedMessage: MessageModel): Promise<QuotedMessageType> {
|
||||||
const { getName } = EmbeddedContact;
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const contact = getContact(quotedMessage.attributes)!;
|
const contact = getContact(quotedMessage.attributes)!;
|
||||||
const attachments = quotedMessage.get('attachments');
|
const attachments = quotedMessage.get('attachments');
|
||||||
const preview = quotedMessage.get('preview');
|
const preview = quotedMessage.get('preview');
|
||||||
const sticker = quotedMessage.get('sticker');
|
const sticker = quotedMessage.get('sticker');
|
||||||
|
|
||||||
const body = quotedMessage.get('body');
|
|
||||||
const embeddedContact = quotedMessage.get('contact');
|
|
||||||
const embeddedContactName =
|
|
||||||
embeddedContact && embeddedContact.length > 0
|
|
||||||
? getName(embeddedContact[0])
|
|
||||||
: '';
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
authorUuid: contact.get('uuid'),
|
authorUuid: contact.get('uuid'),
|
||||||
attachments: isTapToView(quotedMessage.attributes)
|
attachments: isTapToView(quotedMessage.attributes)
|
||||||
|
@ -3873,7 +3864,7 @@ export class ConversationModel extends window.Backbone
|
||||||
isGiftBadge: isGiftBadge(quotedMessage.attributes),
|
isGiftBadge: isGiftBadge(quotedMessage.attributes),
|
||||||
messageId: quotedMessage.get('id'),
|
messageId: quotedMessage.get('id'),
|
||||||
referencedMessageNotFound: false,
|
referencedMessageNotFound: false,
|
||||||
text: body || embeddedContactName,
|
text: quotedMessage.getQuoteBodyText(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2030,6 +2030,18 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQuoteBodyText(): string | undefined {
|
||||||
|
const storyReactionEmoji = this.get('storyReaction')?.emoji;
|
||||||
|
const body = this.get('body');
|
||||||
|
const embeddedContact = this.get('contact');
|
||||||
|
const embeddedContactName =
|
||||||
|
embeddedContact && embeddedContact.length > 0
|
||||||
|
? EmbeddedContact.getName(embeddedContact[0])
|
||||||
|
: '';
|
||||||
|
|
||||||
|
return body || embeddedContactName || storyReactionEmoji;
|
||||||
|
}
|
||||||
|
|
||||||
async copyQuoteContentFromOriginal(
|
async copyQuoteContentFromOriginal(
|
||||||
originalMessage: MessageModel,
|
originalMessage: MessageModel,
|
||||||
quote: QuotedMessageType
|
quote: QuotedMessageType
|
||||||
|
@ -2078,7 +2090,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
quote.isViewOnce = false;
|
quote.isViewOnce = false;
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
quote.text = originalMessage.get('body');
|
quote.text = originalMessage.getQuoteBodyText();
|
||||||
if (firstAttachment) {
|
if (firstAttachment) {
|
||||||
firstAttachment.thumbnail = null;
|
firstAttachment.thumbnail = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue