forked from GitHub/dbot
view notifies by user [#568]
This commit is contained in:
parent
ec72489300
commit
3e8ba74459
@ -62,11 +62,13 @@ var pages = function(dbot) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'/notify/:server/:channel': function(req, res) {
|
'/notify/:server/:item': function(req, res) {
|
||||||
var server = req.params.server,
|
var server = req.params.server,
|
||||||
channel = req.params.channel,
|
|
||||||
notifies = [];
|
notifies = [];
|
||||||
|
|
||||||
|
if(req.params.item.charAt(0) == '#') {
|
||||||
|
var channel = req.params.item;
|
||||||
|
|
||||||
this.db.search('notifies', {
|
this.db.search('notifies', {
|
||||||
'server': server,
|
'server': server,
|
||||||
'channel': channel
|
'channel': channel
|
||||||
@ -92,6 +94,23 @@ var pages = function(dbot) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
var username = req.params.item;
|
||||||
|
|
||||||
|
dbot.api.users.resolveUser(server, username, function(user) {
|
||||||
|
this.db.search('notifies', {
|
||||||
|
'user': user.id
|
||||||
|
}, function(notify) {
|
||||||
|
notify.user = user.primaryNick;
|
||||||
|
notifies.push(notify);
|
||||||
|
}, function() {
|
||||||
|
res.render('notifies', {
|
||||||
|
'server': server,
|
||||||
|
'notifies': _.sortBy(notifies, 'time')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ function searchNotifies(q) {
|
|||||||
var notifies = document.getElementById('notifies');
|
var notifies = document.getElementById('notifies');
|
||||||
for (var i=1, row; row=notifies.rows[i]; i++) {
|
for (var i=1, row; row=notifies.rows[i]; i++) {
|
||||||
if(row.cells[3].innerHTML.indexOf(q) == -1 &&
|
if(row.cells[3].innerHTML.indexOf(q) == -1 &&
|
||||||
row.cells[2].innerHTML.indexOf(q) == -1) {
|
row.cells[2].innerHTML.indexOf(q) == -1 &&
|
||||||
|
row.cells[1].innerHTML.indexOf(q) == -1) {
|
||||||
row.style.display = 'none';
|
row.style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
row.style.display = '';
|
row.style.display = '';
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
extends ../layout
|
extends ../layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
h3 Channels on #{server}
|
h3 Browse by Channel on #{server}
|
||||||
div#backlink
|
div#backlink
|
||||||
a(href='/notify') « Server List
|
a(href='/notify') « Server List
|
||||||
ul#quotelist
|
ul#quotelist
|
||||||
-each channel in channels
|
-each channel in channels
|
||||||
a(href='/notify/'+server+'/'+encodeURIComponent(channel))
|
a(href='/notify/'+server+'/'+encodeURIComponent(channel))
|
||||||
li.quotes #{channel}
|
li.quotes #{channel}
|
||||||
|
|
||||||
|
h3 Browse by User on #{server}
|
||||||
|
ul#quotelist
|
||||||
|
-each nUser in users
|
||||||
|
a(href='/notify/'+server+'/'+encodeURIComponent(nUser.name))
|
||||||
|
li.quotes #{nUser.name} (#{nUser.count})
|
||||||
|
@ -2,7 +2,7 @@ extends ../layout
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
div#backlink
|
div#backlink
|
||||||
a(href='/notify/'+server) « Server Channels
|
a(href='/notify/'+server) « Server
|
||||||
p
|
p
|
||||||
div#controls
|
div#controls
|
||||||
input(type="text", name="search", id="search-text", oninput="searchNotifies(this.value)")
|
input(type="text", name="search", id="search-text", oninput="searchNotifies(this.value)")
|
||||||
|
Loading…
Reference in New Issue
Block a user