mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-26 20:21:40 +01:00
extract fn
This commit is contained in:
parent
b13bfee3d8
commit
2cfe7034e8
@ -68,6 +68,13 @@ function applySyncResponse(data, roomResponse, membership, ownUserId) {
|
|||||||
}
|
}
|
||||||
const unreadNotifications = roomResponse.unread_notifications;
|
const unreadNotifications = roomResponse.unread_notifications;
|
||||||
if (unreadNotifications) {
|
if (unreadNotifications) {
|
||||||
|
data = processNotificationCounts(data, unreadNotifications);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function processNotificationCounts(data, unreadNotifications) {
|
||||||
const highlightCount = unreadNotifications.highlight_count || 0;
|
const highlightCount = unreadNotifications.highlight_count || 0;
|
||||||
if (highlightCount !== data.highlightCount) {
|
if (highlightCount !== data.highlightCount) {
|
||||||
data = data.cloneIfNeeded();
|
data = data.cloneIfNeeded();
|
||||||
@ -78,8 +85,6 @@ function applySyncResponse(data, roomResponse, membership, ownUserId) {
|
|||||||
data = data.cloneIfNeeded();
|
data = data.cloneIfNeeded();
|
||||||
data.notificationCount = notificationCount;
|
data.notificationCount = notificationCount;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user