moved new notification to events.js

v1.18.x
barisusakli 11 years ago
parent 7f5984d1fd
commit d7c367ae91

@ -76,9 +76,8 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
function setupSocketListeners() {
socket.removeListener('event:new_post', onNewPost);
socket.removeListener('event:new_notification', onNewNotification);
socket.on('event:new_post', onNewPost);
socket.on('event:new_notification', onNewNotification);
}
Topic.toTop = function() {
@ -159,12 +158,6 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
createNewPosts(data);
}
function onNewNotification(data) {
var tid = ajaxify.variables.get('topic_id');
if (data && data.tid && parseInt(data.tid, 10) === parseInt(tid, 10)) {
socket.emit('topics.markTopicNotificationsRead', tid);
}
}
function addBlockQuoteHandler() {
$('#post-container').on('click', 'blockquote .toggle', function() {

@ -40,6 +40,8 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
'posts.downvote': togglePostVote,
'posts.unvote': togglePostVote,
'event:new_notification': onNewNotification,
'event:topic.notifyTyping': onNotifyTyping,
'event:topic.stopNotifyTyping': onStopNotifyTyping
};
@ -184,6 +186,14 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
post.find('.downvote').toggleClass('btn-primary downvoted', data.downvote);
}
function onNewNotification(data) {
var tid = ajaxify.variables.get('topic_id');
if (data && data.tid && parseInt(data.tid, 10) === parseInt(tid, 10)) {
socket.emit('topics.markTopicNotificationsRead', tid);
}
}
function onNotifyTyping(data) {
var userEl = $('.thread_active_users [data-uid="' + data.uid + '"]');
userEl.addClass('replying');

Loading…
Cancel
Save