forked from CIT/Vmeda.Online
		
	MOBILE-3039 messages: Fix mark as read not called in 3.6+
This commit is contained in:
		
							parent
							
								
									ed35e57e1c
								
							
						
					
					
						commit
						caa4d9e9b3
					
				| @ -390,11 +390,16 @@ export class AddonMessagesDiscussionPage implements OnDestroy { | |||||||
|         // Call resize to recalculate the dimensions.
 |         // Call resize to recalculate the dimensions.
 | ||||||
|         this.content && this.content.resize(); |         this.content && this.content.resize(); | ||||||
| 
 | 
 | ||||||
|  |         // If we received a new message while using group messaging, force mark messages as read.
 | ||||||
|  |         const last = this.messages[this.messages.length - 1], | ||||||
|  |             forceMark = this.groupMessagingEnabled && last && last.useridfrom != this.currentUserId && this.lastMessage.text != '' | ||||||
|  |                     && (last.text !== this.lastMessage.text || last.timecreated !== this.lastMessage.timecreated); | ||||||
|  | 
 | ||||||
|         // Notify that there can be a new message.
 |         // Notify that there can be a new message.
 | ||||||
|         this.notifyNewMessage(); |         this.notifyNewMessage(); | ||||||
| 
 | 
 | ||||||
|         // Mark retrieved messages as read if they are not.
 |         // Mark retrieved messages as read if they are not.
 | ||||||
|         this.markMessagesAsRead(); |         this.markMessagesAsRead(forceMark); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -576,7 +581,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { | |||||||
|     /** |     /** | ||||||
|      * Mark messages as read. |      * Mark messages as read. | ||||||
|      */ |      */ | ||||||
|     protected markMessagesAsRead(): void { |     protected markMessagesAsRead(forceMark: boolean): void { | ||||||
|         let readChanged = false; |         let readChanged = false; | ||||||
|         const promises = []; |         const promises = []; | ||||||
| 
 | 
 | ||||||
| @ -584,7 +589,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy { | |||||||
|             let messageUnreadFound = false; |             let messageUnreadFound = false; | ||||||
| 
 | 
 | ||||||
|             // Mark all messages at a time if there is any unread message.
 |             // Mark all messages at a time if there is any unread message.
 | ||||||
|             if (this.groupMessagingEnabled) { |             if (forceMark) { | ||||||
|  |                 messageUnreadFound = true; | ||||||
|  |             } else if (this.groupMessagingEnabled) { | ||||||
|                 messageUnreadFound = this.conversation && this.conversation.unreadcount > 0 && this.conversationId > 0; |                 messageUnreadFound = this.conversation && this.conversation.unreadcount > 0 && this.conversationId > 0; | ||||||
|             } else { |             } else { | ||||||
|                 for (const x in this.messages) { |                 for (const x in this.messages) { | ||||||
| @ -648,6 +655,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { | |||||||
|         const last = this.messages[this.messages.length - 1]; |         const last = this.messages[this.messages.length - 1]; | ||||||
| 
 | 
 | ||||||
|         let trigger = false; |         let trigger = false; | ||||||
|  | 
 | ||||||
|         if (!last) { |         if (!last) { | ||||||
|             this.lastMessage = {text: '', timecreated: 0}; |             this.lastMessage = {text: '', timecreated: 0}; | ||||||
|             trigger = true; |             trigger = true; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user