Skip to content
This repository was archived by the owner on Jun 6, 2021. It is now read-only.

Commit 71280c1

Browse files
Show total of all buffers unread/highlights when network collapsed (kiwiirc#1254)
1 parent 494498c commit 71280c1

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/components/StateBrowserNetwork.vue

+31-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
<div class="kiwi-statebrowser-buffer-actions">
1313
<div class="kiwi-statebrowser-channel-labels">
1414
<div
15-
v-if="serverBuffer.flags.unread && showMessageCounts(serverBuffer)"
15+
v-if="serverUnread && showMessageCounts(serverBuffer)"
1616
:class="[
17-
serverBuffer.flags.highlight ?
17+
serverHighlight ?
1818
'kiwi-statebrowser-channel-label--highlight' :
1919
''
2020
]"
2121
class="kiwi-statebrowser-channel-label"
2222
>
23-
{{ serverBuffer.flags.unread > 999 ? "999+": serverBuffer.flags.unread }}
23+
{{ serverUnread > 999 ? "999+": serverUnread }}
2424
</div>
2525
</div>
2626
</div>
@@ -202,6 +202,34 @@ export default {
202202
totalNetworkCount() {
203203
return state.networks.length;
204204
},
205+
serverUnread() {
206+
if (!this.collapsed) {
207+
return this.serverBuffer.flags.unread;
208+
}
209+
let totalUnread = 0;
210+
this.network.buffers.forEach((buffer) => {
211+
if (buffer.isSpecial()) {
212+
return;
213+
}
214+
totalUnread += buffer.flags.unread;
215+
});
216+
return totalUnread;
217+
},
218+
serverHighlight() {
219+
if (!this.collapsed) {
220+
return this.serverBuffer.flags.highlight;
221+
}
222+
let highlight = false;
223+
this.network.buffers.forEach((buffer) => {
224+
if (buffer.isSpecial()) {
225+
return;
226+
}
227+
if (buffer.flags.highlight) {
228+
highlight = true;
229+
}
230+
});
231+
return highlight;
232+
},
205233
filteredBuffers() {
206234
let filter = this.channel_filter;
207235
let filtered = [];

0 commit comments

Comments
 (0)