mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
fix: #8838, fix chat dropdown timestamps
use shorthand like notification dropdown
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
define('chat', [
|
||||
'components',
|
||||
'taskbar',
|
||||
], function (components, taskbar) {
|
||||
'translator',
|
||||
], function (components, taskbar, translator) {
|
||||
var module = {};
|
||||
var newMessage = false;
|
||||
|
||||
@@ -20,27 +21,33 @@ define('chat', [
|
||||
return room.teaser;
|
||||
});
|
||||
|
||||
app.parseAndTranslate('partials/chats/dropdown', { rooms: rooms }, function (html) {
|
||||
chatsListEl.find('*').not('.navigation-link').remove();
|
||||
chatsListEl.prepend(html);
|
||||
app.createUserTooltips(chatsListEl, 'right');
|
||||
chatsListEl.off('click').on('click', '[data-roomid]', function (ev) {
|
||||
if ($(ev.target).parents('.user-link').length) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
translator.toggleTimeagoShorthand(function () {
|
||||
for (var i = 0; i < rooms.length; i += 1) {
|
||||
rooms[i].teaser.timeago = $.timeago(new Date(parseInt(rooms[i].teaser.timestamp, 10)));
|
||||
}
|
||||
translator.toggleTimeagoShorthand();
|
||||
app.parseAndTranslate('partials/chats/dropdown', { rooms: rooms }, function (html) {
|
||||
chatsListEl.find('*').not('.navigation-link').remove();
|
||||
chatsListEl.prepend(html);
|
||||
app.createUserTooltips(chatsListEl, 'right');
|
||||
chatsListEl.off('click').on('click', '[data-roomid]', function (ev) {
|
||||
if ($(ev.target).parents('.user-link').length) {
|
||||
return;
|
||||
}
|
||||
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