Don't display sent stories in groups

This commit is contained in:
Fedor Indutny 2022-10-20 15:47:38 -07:00 committed by GitHub
parent 5dea03f713
commit d26c5b7db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1363,14 +1363,16 @@ export class ConversationModel extends window.Backbone
message: MessageModel,
{ isJustSent }: { isJustSent: boolean } = { isJustSent: false }
): Promise<void> {
await this.beforeAddSingleMessage();
await this.beforeAddSingleMessage(message);
this.doAddSingleMessage(message, { isJustSent });
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.debouncedUpdateLastMessage!();
}
private async beforeAddSingleMessage(): Promise<void> {
private async beforeAddSingleMessage(message: MessageModel): Promise<void> {
await message.hydrateStoryContext();
if (!this.newMessageQueue) {
this.newMessageQueue = new PQueue({
concurrency: 1,
@ -1402,7 +1404,12 @@ export class ConversationModel extends window.Backbone
if (isJustSent && existingConversation && !isLatestInMemory) {
this.loadNewestMessages(undefined, undefined);
} else {
} else if (
// The message has to be not a story or has to be a story reply in direct
// conversation.
!isStory(message.attributes) &&
(message.get('storyId') == null || isDirectConversation(this.attributes))
) {
messagesAdded({
conversationId,
messages: [{ ...message.attributes }],
@ -4029,10 +4036,8 @@ export class ConversationModel extends window.Backbone
const renderStart = Date.now();
// Don't update the conversation with a story reply
if (storyId == null) {
// Perform asynchronous tasks before entering the batching mode
await this.beforeAddSingleMessage();
await this.beforeAddSingleMessage(model);
this.isInReduxBatch = true;
batchDispatch(() => {
@ -4078,7 +4083,6 @@ export class ConversationModel extends window.Backbone
this.isInReduxBatch = false;
}
});
}
if (sticker) {
await addStickerPackReference(model.id, sticker.packId);