Don't display sent stories in groups
This commit is contained in:
parent
5dea03f713
commit
d26c5b7db8
1 changed files with 50 additions and 46 deletions
|
@ -1363,14 +1363,16 @@ export class ConversationModel extends window.Backbone
|
||||||
message: MessageModel,
|
message: MessageModel,
|
||||||
{ isJustSent }: { isJustSent: boolean } = { isJustSent: false }
|
{ isJustSent }: { isJustSent: boolean } = { isJustSent: false }
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this.beforeAddSingleMessage();
|
await this.beforeAddSingleMessage(message);
|
||||||
this.doAddSingleMessage(message, { isJustSent });
|
this.doAddSingleMessage(message, { isJustSent });
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
this.debouncedUpdateLastMessage!();
|
this.debouncedUpdateLastMessage!();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async beforeAddSingleMessage(): Promise<void> {
|
private async beforeAddSingleMessage(message: MessageModel): Promise<void> {
|
||||||
|
await message.hydrateStoryContext();
|
||||||
|
|
||||||
if (!this.newMessageQueue) {
|
if (!this.newMessageQueue) {
|
||||||
this.newMessageQueue = new PQueue({
|
this.newMessageQueue = new PQueue({
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
|
@ -1402,7 +1404,12 @@ export class ConversationModel extends window.Backbone
|
||||||
|
|
||||||
if (isJustSent && existingConversation && !isLatestInMemory) {
|
if (isJustSent && existingConversation && !isLatestInMemory) {
|
||||||
this.loadNewestMessages(undefined, undefined);
|
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({
|
messagesAdded({
|
||||||
conversationId,
|
conversationId,
|
||||||
messages: [{ ...message.attributes }],
|
messages: [{ ...message.attributes }],
|
||||||
|
@ -4029,10 +4036,8 @@ export class ConversationModel extends window.Backbone
|
||||||
|
|
||||||
const renderStart = Date.now();
|
const renderStart = Date.now();
|
||||||
|
|
||||||
// Don't update the conversation with a story reply
|
|
||||||
if (storyId == null) {
|
|
||||||
// Perform asynchronous tasks before entering the batching mode
|
// Perform asynchronous tasks before entering the batching mode
|
||||||
await this.beforeAddSingleMessage();
|
await this.beforeAddSingleMessage(model);
|
||||||
|
|
||||||
this.isInReduxBatch = true;
|
this.isInReduxBatch = true;
|
||||||
batchDispatch(() => {
|
batchDispatch(() => {
|
||||||
|
@ -4078,7 +4083,6 @@ export class ConversationModel extends window.Backbone
|
||||||
this.isInReduxBatch = false;
|
this.isInReduxBatch = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (sticker) {
|
if (sticker) {
|
||||||
await addStickerPackReference(model.id, sticker.packId);
|
await addStickerPackReference(model.id, sticker.packId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue