Skip to content

Commit bed7c70

Browse files
authored
Make Mark All As Read optional (#155)
1 parent 7b35659 commit bed7c70

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

source/github-notifications-preview.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ async function openDropdown({currentTarget: indicator}) {
130130
if (!isOpen(dropdown) && list.length > 0) {
131131
const container = $('.NPG-dropdown', dropdown);
132132
empty(container);
133+
133134
const dropdownHeader = (
134135
<div
135136
style={{
@@ -168,7 +169,11 @@ async function openDropdown({currentTarget: indicator}) {
168169
</div>
169170
</div>
170171
);
171-
container.append(dropdownHeader);
172+
173+
if (options.markAllAsRead) {
174+
container.append(dropdownHeader);
175+
}
176+
172177
container.append(...list);
173178

174179
delegate('.NPG-dropdown button', 'click', async event => {
@@ -206,7 +211,10 @@ async function openDropdown({currentTarget: indicator}) {
206211

207212
// All notifications are read, remove the header
208213
if ($$('.js-notifications-list-item, .js-notifications-group').length === 0) {
209-
dropdownHeader.remove();
214+
if (options.markAllAsRead) {
215+
dropdownHeader.remove();
216+
}
217+
210218
closeDropdown();
211219
}
212220
});

source/options-storage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import OptionsSync from 'webext-options-sync';
33
const optionsStorage = new OptionsSync({
44
defaults: {
55
previewCount: true,
6+
markAllAsRead: true,
67
dropdown: 'compact',
78
participating: false,
89
closeOnMouseleave: false,

source/options.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
Show notification number in blue bubble
1010
</label>
1111
</p>
12+
<p>
13+
<label>
14+
<input type="checkbox" name="markAllAsRead">
15+
Show "Mark all as read" link
16+
</label>
17+
</p>
1218
<p>
1319
<label>
1420
<input type="checkbox" name="participating">

0 commit comments

Comments
 (0)