forked from GitHub/dbot
done [#575]
This commit is contained in:
parent
26bce2e8a0
commit
6d1d5d0afe
@ -10,10 +10,7 @@
|
||||
"bio": null,
|
||||
"favourites": {
|
||||
"colour": null
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"timezone": null
|
||||
},
|
||||
}
|
||||
},
|
||||
"dependencies": [ "web", "quotes", "users" ]
|
||||
|
@ -1,5 +1,6 @@
|
||||
var _ = require('underscore')._,
|
||||
async = require('async');
|
||||
async = require('async'),
|
||||
moment = require('moment-timezone');
|
||||
|
||||
var pages = function(dbot) {
|
||||
var pages = {
|
||||
@ -55,9 +56,16 @@ var pages = function(dbot) {
|
||||
user = req.user,
|
||||
notifies = this.pending[user.id];
|
||||
|
||||
notifies = _.sortBy(notifies, 'time').reverse();
|
||||
if(req.user.timezone) {
|
||||
_.each(notifies, function(v, k) {
|
||||
v.time = moment(v.time).tz(req.user.timezone);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('missing_notifies', {
|
||||
'user': user.primaryNick,
|
||||
'notifies': _.sortBy(notifies, 'time')
|
||||
'notifies': notifies
|
||||
});
|
||||
|
||||
if(_.has(dbot.modules, 'log')) {
|
||||
@ -92,9 +100,16 @@ var pages = function(dbot) {
|
||||
next();
|
||||
}
|
||||
}, function() {
|
||||
notifies = _.sortBy(notifies, 'time').reverse();
|
||||
if(req.user.timezone) {
|
||||
_.each(notifies, function(v, k) {
|
||||
v.time = moment(v.time).tz(req.user.timezone);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('notifies', {
|
||||
'server': server,
|
||||
'notifies': _.sortBy(notifies, 'time').reverse()
|
||||
'notifies': notifies
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -108,9 +123,16 @@ var pages = function(dbot) {
|
||||
notify.user = user.primaryNick;
|
||||
notifies.push(notify);
|
||||
}, function() {
|
||||
notifies = _.sortBy(notifies, 'time').reverse();
|
||||
if(req.user.timezone) {
|
||||
_.each(notifies, function(v, k) {
|
||||
v.time = moment(v.time).tz(req.user.timezone);
|
||||
});
|
||||
}
|
||||
|
||||
res.render('notifies', {
|
||||
'server': server,
|
||||
'notifies': _.sortBy(notifies, 'time').reverse()
|
||||
'notifies': notifies
|
||||
});
|
||||
});
|
||||
}.bind(this));
|
||||
|
@ -1,4 +1,5 @@
|
||||
var _ = require('underscore')._;
|
||||
var _ = require('underscore')._,
|
||||
moment = require('moment-timezone');
|
||||
|
||||
var commands = function(dbot) {
|
||||
var commands = {
|
||||
@ -34,6 +35,23 @@ var commands = function(dbot) {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'~timezone': function(event) {
|
||||
if(event.params[1]) {
|
||||
try {
|
||||
moment().tz(event.params[1]);
|
||||
} catch(err) {
|
||||
return event.reply('Invalid timezone. See http://momentjs.com/timezone/');
|
||||
}
|
||||
|
||||
event.rUser.timezone = event.params[1];
|
||||
this.db.save('users', event.rUser.id, event.rUser, function() {
|
||||
event.reply('Timezone updated.');
|
||||
});
|
||||
} else {
|
||||
event.reply('Current timezone: ' + event.rUser.timezone);
|
||||
}
|
||||
},
|
||||
|
||||
'~setmobilealias': function(event) {
|
||||
if(_.include(event.rUser.aliases, event.params[1])) {
|
||||
|
@ -15,5 +15,5 @@ block content
|
||||
tbody
|
||||
each notify in notifies
|
||||
tr
|
||||
td #{new Date(notify.time)}
|
||||
td #{notify.time}
|
||||
td #{notify.message}
|
||||
|
@ -18,7 +18,7 @@ block content
|
||||
tbody
|
||||
for notify in notifies
|
||||
tr
|
||||
td #{new Date(notify.time)}
|
||||
td #{notify.time}
|
||||
td #{notify.channel}
|
||||
td #{notify.type}
|
||||
td #{notify.user}
|
||||
|
Loading…
Reference in New Issue
Block a user