forked from cory/tildefriends
		
	ssb: Fix an instance of channels being stuck unread.
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
| 	"type": "tildefriends-app", | 	"type": "tildefriends-app", | ||||||
| 	"emoji": "🐌", | 	"emoji": "🐌", | ||||||
| 	"previous": "&UuIvaWISWWRqgpN5ccS32C71334ofLV+qMcaDDqUn28=.sha256" | 	"previous": "&hWgKPOx3M3T7BufeywObcOCHvsdRfVAoZ9LErkPhJPE=.sha256" | ||||||
| } | } | ||||||
|   | |||||||
| @@ -443,8 +443,8 @@ ${JSON.stringify(mention, null, 2)}</pre | |||||||
| 								.users=${self.users} | 								.users=${self.users} | ||||||
| 								.drafts=${self.drafts} | 								.drafts=${self.drafts} | ||||||
| 								.expanded=${self.expanded} | 								.expanded=${self.expanded} | ||||||
| 								channel=${this.channel} | 								channel=${self.channel} | ||||||
| 								channel_unread=${this.channel_unread} | 								channel_unread=${self.channel_unread} | ||||||
| 							></tf-message> | 							></tf-message> | ||||||
| 						` | 						` | ||||||
| 					)} | 					)} | ||||||
|   | |||||||
| @@ -165,6 +165,7 @@ class TfNewsElement extends LitElement { | |||||||
| 			} else { | 			} else { | ||||||
| 				if (group.length > 0) { | 				if (group.length > 0) { | ||||||
| 					result.push({ | 					result.push({ | ||||||
|  | 						rowid: Math.max(...group.map(x => x.rowid)), | ||||||
| 						type: 'contact_group', | 						type: 'contact_group', | ||||||
| 						messages: group, | 						messages: group, | ||||||
| 					}); | 					}); | ||||||
| @@ -175,6 +176,7 @@ class TfNewsElement extends LitElement { | |||||||
| 		} | 		} | ||||||
| 		if (group.length > 0) { | 		if (group.length > 0) { | ||||||
| 			result.push({ | 			result.push({ | ||||||
|  | 				rowid: Math.max(...group.map(x => x.rowid)), | ||||||
| 				type: 'contact_group', | 				type: 'contact_group', | ||||||
| 				messages: group, | 				messages: group, | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ class TfTabNewsFeedElement extends LitElement { | |||||||
| 			drafts: {type: Object}, | 			drafts: {type: Object}, | ||||||
| 			expanded: {type: Object}, | 			expanded: {type: Object}, | ||||||
| 			channels_unread: {type: Object}, | 			channels_unread: {type: Object}, | ||||||
|  | 			channels_latest: {type: Object}, | ||||||
| 			loading: {type: Number}, | 			loading: {type: Number}, | ||||||
| 			time_range: {type: Array}, | 			time_range: {type: Array}, | ||||||
| 			time_loading: {type: Array}, | 			time_loading: {type: Array}, | ||||||
| @@ -31,6 +32,7 @@ class TfTabNewsFeedElement extends LitElement { | |||||||
| 		this.drafts = {}; | 		this.drafts = {}; | ||||||
| 		this.expanded = {}; | 		this.expanded = {}; | ||||||
| 		this.channels_unread = {}; | 		this.channels_unread = {}; | ||||||
|  | 		this.channels_latest = {}; | ||||||
| 		this.start_time = new Date().valueOf(); | 		this.start_time = new Date().valueOf(); | ||||||
| 		this.time_range = [0, 0]; | 		this.time_range = [0, 0]; | ||||||
| 		this.time_loading = undefined; | 		this.time_loading = undefined; | ||||||
| @@ -320,7 +322,7 @@ class TfTabNewsFeedElement extends LitElement { | |||||||
| 	mark_all_read() { | 	mark_all_read() { | ||||||
| 		let newest = this.messages.reduce( | 		let newest = this.messages.reduce( | ||||||
| 			(accumulator, current) => Math.max(accumulator, current.rowid), | 			(accumulator, current) => Math.max(accumulator, current.rowid), | ||||||
| 			-1 | 			this.channels_latest[this.channel()] ?? -1 | ||||||
| 		); | 		); | ||||||
| 		if (newest >= 0) { | 		if (newest >= 0) { | ||||||
| 			this.dispatchEvent( | 			this.dispatchEvent( | ||||||
|   | |||||||
| @@ -277,6 +277,7 @@ class TfTabNewsElement extends LitElement { | |||||||
| 					@tf-draft=${this.draft} | 					@tf-draft=${this.draft} | ||||||
| 					@tf-expand=${this.on_expand} | 					@tf-expand=${this.on_expand} | ||||||
| 					.channels_unread=${this.channels_unread} | 					.channels_unread=${this.channels_unread} | ||||||
|  | 					.channels_latest=${this.channels_latest} | ||||||
| 				></tf-tab-news-feed> | 				></tf-tab-news-feed> | ||||||
| 			</div> | 			</div> | ||||||
| 		`; | 		`; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user