client: fix clearing ALL unread flags when clearing a single one

This commit is contained in:
mappu 2017-02-05 20:07:28 +13:00
parent ef9057383d
commit ff075e2e7e

View File

@ -450,7 +450,13 @@ var tab_set = function(tab) {
var tabitems = $(".tabitem"); var tabitems = $(".tabitem");
for (var i in tabitems) { for (var i in tabitems) {
try { try {
tabitems[i].className = "tabitem" + (tabitems[i].getAttribute('data-tab') === tab ? ' selected' : ''); // Update UNREAD/SELECTED flags for the target
var was_unread = (tabitems[i].className.indexOf("unread") !== -1);
var is_target = (tabitems[i].getAttribute('data-tab') === tab);
var is_still_unread = (was_unread && !is_target);
tabitems[i].className = "tabitem" + (is_target ? ' selected' : '') + (is_still_unread ? ' unread' : '');
} catch (e) {}; } catch (e) {};
} }