Show story replies in the timeline

This commit is contained in:
Josh Perez 2022-03-16 13:30:14 -04:00 committed by GitHub
parent 55716c5db6
commit 3620309f22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 705 additions and 461 deletions

View file

@ -150,6 +150,7 @@ import { findStoryMessage } from '../util/findStoryMessage';
import { isConversationAccepted } from '../util/isConversationAccepted';
import { getStoryDataFromMessageAttributes } from '../services/storyLoader';
import type { ConversationQueueJobData } from '../jobs/conversationJobQueue';
import { getMessageById } from '../messages/getMessageById';
/* eslint-disable camelcase */
/* eslint-disable more/no-then */
@ -305,6 +306,33 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
);
}
async hydrateStoryContext(): Promise<void> {
const storyId = this.get('storyId');
if (!storyId) {
return;
}
if (this.get('storyReplyContext')) {
return;
}
const message = await getMessageById(storyId);
if (!message) {
return;
}
const attachments = message.get('attachments');
this.set({
storyReplyContext: {
attachment: attachments ? attachments[0] : undefined,
authorUuid: message.get('sourceUuid'),
messageId: message.get('id'),
},
});
}
getPropsForMessageDetail(ourConversationId: string): PropsForMessageDetail {
const newIdentity = window.i18n('newIdentity');
const OUTGOING_KEY_ERROR = 'OutgoingIdentityKeyError';
@ -2212,6 +2240,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
quote,
storyId: storyQuote?.id,
};
const dataMessage = await upgradeMessageSchema(withQuoteReference);
try {