mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 16:41:21 +01:00
fix: #8838, fix chat dropdown timestamps
use shorthand like notification dropdown
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
define('chat', [
|
define('chat', [
|
||||||
'components',
|
'components',
|
||||||
'taskbar',
|
'taskbar',
|
||||||
], function (components, taskbar) {
|
'translator',
|
||||||
|
], function (components, taskbar, translator) {
|
||||||
var module = {};
|
var module = {};
|
||||||
var newMessage = false;
|
var newMessage = false;
|
||||||
|
|
||||||
@@ -20,27 +21,33 @@ define('chat', [
|
|||||||
return room.teaser;
|
return room.teaser;
|
||||||
});
|
});
|
||||||
|
|
||||||
app.parseAndTranslate('partials/chats/dropdown', { rooms: rooms }, function (html) {
|
translator.toggleTimeagoShorthand(function () {
|
||||||
chatsListEl.find('*').not('.navigation-link').remove();
|
for (var i = 0; i < rooms.length; i += 1) {
|
||||||
chatsListEl.prepend(html);
|
rooms[i].teaser.timeago = $.timeago(new Date(parseInt(rooms[i].teaser.timestamp, 10)));
|
||||||
app.createUserTooltips(chatsListEl, 'right');
|
}
|
||||||
chatsListEl.off('click').on('click', '[data-roomid]', function (ev) {
|
translator.toggleTimeagoShorthand();
|
||||||
if ($(ev.target).parents('.user-link').length) {
|
app.parseAndTranslate('partials/chats/dropdown', { rooms: rooms }, function (html) {
|
||||||
return;
|
chatsListEl.find('*').not('.navigation-link').remove();
|
||||||
}
|
chatsListEl.prepend(html);
|
||||||
var roomId = $(this).attr('data-roomid');
|
app.createUserTooltips(chatsListEl, 'right');
|
||||||
if (!ajaxify.currentPage.match(/^chats\//)) {
|
chatsListEl.off('click').on('click', '[data-roomid]', function (ev) {
|
||||||
app.openChat(roomId);
|
if ($(ev.target).parents('.user-link').length) {
|
||||||
} else {
|
return;
|
||||||
ajaxify.go('user/' + app.user.userslug + '/chats/' + roomId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('[component="chats/mark-all-read"]').off('click').on('click', function () {
|
|
||||||
socket.emit('modules.chats.markAllRead', function (err) {
|
|
||||||
if (err) {
|
|
||||||
return app.alertError(err);
|
|
||||||
}
|
}
|
||||||
|
var roomId = $(this).attr('data-roomid');
|
||||||
|
if (!ajaxify.currentPage.match(/^chats\//)) {
|
||||||
|
app.openChat(roomId);
|
||||||
|
} else {
|
||||||
|
ajaxify.go('user/' + app.user.userslug + '/chats/' + roomId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[component="chats/mark-all-read"]').off('click').on('click', function () {
|
||||||
|
socket.emit('modules.chats.markAllRead', function (err) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user