Skip to content

Commit 7b35659

Browse files
authored
fix: indicator doesn't update after mask as read (#154)
1 parent 44e529f commit 7b35659

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

source/github-notifications-preview.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,7 @@
206206
#AppHeader-notifications-button {
207207
z-index: 81;
208208
}
209+
210+
#AppHeader-notifications-button > svg::before {
211+
display: var(--notifications-icon-indicator-display, "block");
212+
}

source/github-notifications-preview.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ function isOpen(element) {
5959
return elementExists('.NPG-container[open], .NPG-loading', element);
6060
}
6161

62+
function updateNotificationsIndicatorStatus(show) {
63+
$('#AppHeader-notifications-button > svg').style.setProperty(
64+
'--notifications-icon-indicator-display',
65+
show ? 'block' : 'none',
66+
);
67+
}
68+
6269
async function updateUnreadCount() {
6370
const latestStatusElement = $('.notification-indicator .mail-status', await notifications.dom);
64-
const latestCount = $('.js-notification-inboxes .selected .count', await notifications.dom).textContent;
71+
const latestCount = $('.js-notification-inboxes .selected .count', await notifications.dom)?.textContent ?? '';
6572
const rghCount = getRefinedGitHubUnreadCount();
73+
updateNotificationsIndicatorStatus(latestCount && (Number(latestCount) + rghCount > 0));
6674

6775
for (const statusElement of $$('.notification-indicator .mail-status')) {
6876
if (options.previewCount && statusElement.textContent !== latestCount) {

0 commit comments

Comments
 (0)