Ensure expireTimer updates in Note to Self are never unread
This commit is contained in:
		
					parent
					
						
							
								9bcc3041cd
							
						
					
				
			
			
				commit
				
					
						d99e29dd25
					
				
			
		
					 1 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
					@ -1365,9 +1365,6 @@ export class ConversationModel extends window.Backbone
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.addSingleMessage(message);
 | 
					    this.addSingleMessage(message);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
 | 
					 | 
				
			||||||
    this.debouncedUpdateLastMessage!();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // New messages might arrive while we're in the middle of a bulk fetch from the
 | 
					  // New messages might arrive while we're in the middle of a bulk fetch from the
 | 
				
			||||||
| 
						 | 
					@ -1378,6 +1375,9 @@ export class ConversationModel extends window.Backbone
 | 
				
			||||||
  ): Promise<void> {
 | 
					  ): Promise<void> {
 | 
				
			||||||
    await this.beforeAddSingleMessage();
 | 
					    await this.beforeAddSingleMessage();
 | 
				
			||||||
    this.doAddSingleMessage(message, { isJustSent });
 | 
					    this.doAddSingleMessage(message, { isJustSent });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
 | 
				
			||||||
 | 
					    this.debouncedUpdateLastMessage!();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async beforeAddSingleMessage(): Promise<void> {
 | 
					  private async beforeAddSingleMessage(): Promise<void> {
 | 
				
			||||||
| 
						 | 
					@ -4541,6 +4541,9 @@ export class ConversationModel extends window.Backbone
 | 
				
			||||||
    //   to be above the message that initiated that change, hence the subtraction.
 | 
					    //   to be above the message that initiated that change, hence the subtraction.
 | 
				
			||||||
    const sentAt = (providedSentAt || receivedAtMS) - 1;
 | 
					    const sentAt = (providedSentAt || receivedAtMS) - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const isNoteToSelf = isMe(this.attributes);
 | 
				
			||||||
 | 
					    const shouldBeRead = isNoteToSelf || isInitialSync;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const model = new window.Whisper.Message({
 | 
					    const model = new window.Whisper.Message({
 | 
				
			||||||
      conversationId: this.id,
 | 
					      conversationId: this.id,
 | 
				
			||||||
      expirationTimerUpdate: {
 | 
					      expirationTimerUpdate: {
 | 
				
			||||||
| 
						 | 
					@ -4550,10 +4553,10 @@ export class ConversationModel extends window.Backbone
 | 
				
			||||||
        fromGroupUpdate,
 | 
					        fromGroupUpdate,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      flags: Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
 | 
					      flags: Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
 | 
				
			||||||
      readStatus: isInitialSync ? ReadStatus.Read : ReadStatus.Unread,
 | 
					      readStatus: shouldBeRead ? ReadStatus.Read : ReadStatus.Unread,
 | 
				
			||||||
      received_at_ms: receivedAtMS,
 | 
					      received_at_ms: receivedAtMS,
 | 
				
			||||||
      received_at: receivedAt ?? window.Signal.Util.incrementMessageCounter(),
 | 
					      received_at: receivedAt ?? window.Signal.Util.incrementMessageCounter(),
 | 
				
			||||||
      seenStatus: isInitialSync ? SeenStatus.Seen : SeenStatus.Unseen,
 | 
					      seenStatus: shouldBeRead ? SeenStatus.Seen : SeenStatus.Unseen,
 | 
				
			||||||
      sent_at: sentAt,
 | 
					      sent_at: sentAt,
 | 
				
			||||||
      type: 'timer-notification',
 | 
					      type: 'timer-notification',
 | 
				
			||||||
      // TODO: DESKTOP-722
 | 
					      // TODO: DESKTOP-722
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue