mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 11:42:36 +01:00
finish [#578]
This commit is contained in:
parent
8e4ac8d503
commit
6b128ec798
@ -45,8 +45,50 @@ var pages = function(dbot) {
|
||||
});
|
||||
},
|
||||
|
||||
'/notify/:server/missing': function(req, res) {
|
||||
var server = req.params.server,
|
||||
'/notify/stream': function(req, res) {
|
||||
var staffedChannels = [],
|
||||
notifications = [];
|
||||
|
||||
async.each(req.user.channels, function(cId, done) {
|
||||
dbot.api.users.getChannel(cId, function(channel) {
|
||||
if(_.include(channel.op, req.user.id) ||
|
||||
(this.config.notifyVoice && _.include(channel.voice, req.user.id))) {
|
||||
staffedChannels.push(channel.name);
|
||||
}
|
||||
done();
|
||||
}.bind(this));
|
||||
}.bind(this), function() {
|
||||
async.each(staffedChannels, function(cName, done) {
|
||||
this.db.search('notifies', { 'server': req.user.server, 'channel': cName }, function(notify) {
|
||||
notifications.push(notify);
|
||||
}, function() {
|
||||
done();
|
||||
});
|
||||
}.bind(this), function() {
|
||||
async.each(notifications, function(notify, done) {
|
||||
dbot.api.users.getUser(notify.user, function(user) {
|
||||
if(user) notify.user = user.primaryNick;
|
||||
done();
|
||||
});
|
||||
}, function() {
|
||||
notifications = _.sortBy(notifications, 'time').reverse();
|
||||
if(req.user.timezone) {
|
||||
_.each(notifications, function(v, k) {
|
||||
v.time = moment(v.time).tz(req.user.timezone);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('notifies', {
|
||||
'server': req.user.server,
|
||||
'notifies': notifications
|
||||
});
|
||||
});
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
'/notify/missing': function(req, res) {
|
||||
var server = req.user.server,
|
||||
user = req.user,
|
||||
notifies = this.pending[user.id];
|
||||
|
||||
@ -133,46 +175,6 @@ var pages = function(dbot) {
|
||||
}
|
||||
},
|
||||
|
||||
'/notify/stream': function(req, res) {
|
||||
var staffedChannels = [],
|
||||
notifications = [];
|
||||
async.each(req.user.channels, function(cId, done) {
|
||||
dbot.api.users.getChannel(cId, function(channel) {
|
||||
if(_.include(channel.op, req.user.id) ||
|
||||
(this.config.notifyVoice && _.include(channel.voice, req.user.id))) {
|
||||
staffedChannels.push(channel.name);
|
||||
}
|
||||
done();
|
||||
}.bind(this));
|
||||
}.bind(this), function() {
|
||||
async.each(staffedChannels, function(cName, done) {
|
||||
this.db.scan('notifies', { 'server': req.user.server, 'channel': cName }, function(notify) {
|
||||
notifications.push(notify);
|
||||
}, function() {
|
||||
done();
|
||||
});
|
||||
}, function() {
|
||||
async.each(notifications, function(notify, done) {
|
||||
dbot.api.users.getUser(notify.user, function(user) {
|
||||
if(user) notify.user = user.primaryNick;
|
||||
done();
|
||||
});
|
||||
}, function() {
|
||||
notifications = _.sortBy(notifications, 'time').reverse();
|
||||
if(req.user.timezone) {
|
||||
_.each(notifications, function(v, k) {
|
||||
v.time = moment(v.time).tz(req.user.timezone);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('notifies', {
|
||||
'server': req.user.server,
|
||||
'notifies': notifications
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return pages;
|
||||
|
@ -3,6 +3,10 @@ extends ../layout
|
||||
block content
|
||||
div#backlink
|
||||
a(href='/') « Home
|
||||
h3
|
||||
a(href='/notify/stream') My Notification Stream
|
||||
|
|
||||
a(href='/notify/missing') My Missed Notifications
|
||||
h3 Browse by Channel on #{server}
|
||||
ul#quotelist
|
||||
-each count, name in channels
|
||||
@ -14,5 +18,3 @@ block content
|
||||
-each nUser in users
|
||||
a(href='/notify/'+encodeURIComponent(nUser.name))
|
||||
li.quotes #{nUser.name} (#{nUser.count})
|
||||
h3
|
||||
a(href='/notify/missing') My Missed Notifications
|
||||
|
Loading…
Reference in New Issue
Block a user