From 0c744a947e52944441b84e406ae0f5d7a3c5a1ce Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 24 Mar 2014 15:58:02 -0400 Subject: [PATCH] chat will use timeago --- public/src/modules/chat.js | 8 ++++---- src/controllers/index.js | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index fca3edb5f8..500c7713a5 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -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 = '' + date.toLocaleTimeString() + ' '; - message = $('
  • ' + S(prefix + message).stripTags('p').s + '
  • '); + var time = ' '; + message = $('
  • ' + S(message + time).stripTags('p').s + '
  • '); message.find('img:not(".chat-user-image")').addClass('img-responsive'); + message.find('span.timeago').timeago(); + chatContent.append(message); scrollToBottom(chatContent); diff --git a/src/controllers/index.js b/src/controllers/index.js index 924da87bfe..fc9401cd3e 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -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; });