mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
chat will use timeago
This commit is contained in:
@@ -235,12 +235,12 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) {
|
||||
module.appendChatMessage = function(chatModal, message, timestamp) {
|
||||
var chatContent = chatModal.find('#chat-content');
|
||||
|
||||
var date = new Date(parseInt(timestamp, 10));
|
||||
|
||||
var prefix = '<span class="chat-timestamp">' + date.toLocaleTimeString() + '</span> ';
|
||||
message = $('<li>' + S(prefix + message).stripTags('p').s + '</li>');
|
||||
var time = '<span class="chat-timestamp pull-right timeago" title="' + utils.toISOString(timestamp) + '"></span> ';
|
||||
message = $('<li>' + S(message + time).stripTags('p').s + '</li>');
|
||||
|
||||
message.find('img:not(".chat-user-image")').addClass('img-responsive');
|
||||
message.find('span.timeago').timeago();
|
||||
|
||||
chatContent.append(message);
|
||||
|
||||
scrollToBottom(chatContent);
|
||||
|
||||
@@ -52,8 +52,12 @@ Controllers.home = function(req, res, next) {
|
||||
next(null);
|
||||
},
|
||||
categories: function (next) {
|
||||
var uid = (req.user) ? req.user.uid : 0;
|
||||
var uid = req.user ? req.user.uid : 0;
|
||||
categories.getAllCategories(uid, function (err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
data.categories = data.categories.filter(function (category) {
|
||||
return !category.disabled;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user