polfan-server-js-client 0.2.109 → 0.2.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +13 -18
- package/build/index.cjs.js +8 -1
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/state-tracker/FollowedTopicsManager.d.ts +1 -0
- package/package.json +1 -1
- package/src/state-tracker/FollowedTopicsManager.ts +8 -1
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ interface EventMap {
|
|
|
20
20
|
export interface UnreadSummary {
|
|
21
21
|
mentionCount: number;
|
|
22
22
|
unreadTopicCount: number;
|
|
23
|
+
unreadRoomCount: number;
|
|
23
24
|
isUnread: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -168,6 +169,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
|
|
|
168
169
|
|
|
169
170
|
let mentionCount = 0;
|
|
170
171
|
let unreadTopicCount = 0;
|
|
172
|
+
let unreadRoomCount = 0;
|
|
171
173
|
|
|
172
174
|
for (const roomId of roomIds) {
|
|
173
175
|
const collection = await this.getForRoom(roomId);
|
|
@@ -176,12 +178,17 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
|
|
|
176
178
|
continue;
|
|
177
179
|
}
|
|
178
180
|
|
|
181
|
+
let isRoomUnreadCount = false;
|
|
179
182
|
for (const topic of collection.items) {
|
|
180
183
|
if (targetTopicId && topic.location.topicId !== targetTopicId) {
|
|
181
184
|
continue;
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
if (topic.isUnread) {
|
|
188
|
+
if (!isRoomUnreadCount) {
|
|
189
|
+
unreadRoomCount++;
|
|
190
|
+
isRoomUnreadCount = true;
|
|
191
|
+
}
|
|
185
192
|
unreadTopicCount++;
|
|
186
193
|
}
|
|
187
194
|
|
|
@@ -189,7 +196,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
|
|
|
189
196
|
}
|
|
190
197
|
}
|
|
191
198
|
|
|
192
|
-
const result = { mentionCount, unreadTopicCount, isUnread: unreadTopicCount > 0 };
|
|
199
|
+
const result = { mentionCount, unreadTopicCount, unreadRoomCount, isUnread: unreadTopicCount > 0 };
|
|
193
200
|
this.summariesCache.set(cacheKey, result);
|
|
194
201
|
|
|
195
202
|
return result;
|