mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 09:11:28 -05:00
webui: unread chat message counter in menu
This commit is contained in:
parent
e9af1794dd
commit
0afa2e3726
@ -54,5 +54,5 @@ should provide forward, backward and follow-list-end
|
|||||||
need 4 master
|
need 4 master
|
||||||
-------------
|
-------------
|
||||||
[ ] unsubscribe lobby
|
[ ] unsubscribe lobby
|
||||||
[ ] unread chat message counter in menu
|
[X] unread chat message counter in menu
|
||||||
[ ] list chat-lobby participants
|
[ ] list chat-lobby participants
|
||||||
|
@ -70,6 +70,24 @@ module.exports = { nodes: [
|
|||||||
{
|
{
|
||||||
name: "chat",
|
name: "chat",
|
||||||
runstate: "running_ok.*",
|
runstate: "running_ok.*",
|
||||||
|
counter: rs.counting2([
|
||||||
|
{
|
||||||
|
path: "peers",
|
||||||
|
counter: function(peer) {
|
||||||
|
var sum = 0;
|
||||||
|
peer.locations.map(function (loc) {
|
||||||
|
sum += parseInt(loc.unread_msgs);
|
||||||
|
});
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "chat/lobbies",
|
||||||
|
counter: function(lobby) {
|
||||||
|
return lobby.unread_msg_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "shutdown",
|
name: "shutdown",
|
||||||
|
@ -282,6 +282,26 @@ rs.counting = function(path, counterfnkt) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// counting in menu
|
||||||
|
rs.counting2 = function(targets) {
|
||||||
|
return function () {
|
||||||
|
var sum = 0;
|
||||||
|
targets.map(function(target) {
|
||||||
|
var data=rs(target.path);
|
||||||
|
if (data != undefined) {
|
||||||
|
data.map(function(item){
|
||||||
|
sum += parseInt(target.counter(item));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
if (sum > 0) {
|
||||||
|
return " (" + sum + ")";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// listing data-elements
|
// listing data-elements
|
||||||
rs.list = function(path, buildfktn, sortfktn){
|
rs.list = function(path, buildfktn, sortfktn){
|
||||||
var list = rs(path);
|
var list = rs(path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user