v1.18.x
Barış Soner Uşaklı 10 years ago
parent 835d4db481
commit df3e007120

@ -100,7 +100,7 @@ define('forum/topic/events', [
var editedPostEl = components.get('post/content', data.pid), var editedPostEl = components.get('post/content', data.pid),
topicTitle = components.get('topic/title'); topicTitle = components.get('topic/title');
if (topicTitle.length) { if (topicTitle.length && data.title) {
topicTitle.fadeOut(250, function() { topicTitle.fadeOut(250, function() {
topicTitle.html(data.title).fadeIn(250); topicTitle.html(data.title).fadeIn(250);
}); });

@ -306,16 +306,41 @@ SocketPosts.edit = function(socket, data, callback) {
return callback(err); return callback(err);
} }
websockets.in('topic_' + results.topic.tid).emit('event:post_edited', { var result = {
pid: data.pid, pid: data.pid,
handle: data.handle, handle: data.handle,
title: results.topic.title, title: results.topic.title,
isMainPost: results.topic.isMainPost, isMainPost: results.topic.isMainPost,
tags: results.topic.tags, tags: results.topic.tags,
content: results.content content: results.content
}); };
if (parseInt(results.postData.deleted) !== 1) {
websockets.in('topic_' + results.topic.tid).emit('event:post_edited', result);
callback();
return;
}
socket.emit('event:post_edited', result);
callback(); callback();
async.parallel({
admins: async.apply(groups.getMembers, 'administrators', 0, -1),
moderators: async.apply(groups.getMembers, 'cid:' + results.topic.cid + ':privileges:mods', 0, -1),
uidsInTopic: async.apply(websockets.getUidsInRoom, 'topic_' + results.topic.tid)
}, function(err, results) {
if (err) {
return winston.error(err);
}
var uids = results.uidsInTopic.filter(function(uid) {
return results.admins.indexOf(uid) !== -1 || results.moderators.indexOf(uid) !== -1;
});
uids.forEach(function(uid) {
websockets.in('uid_' + uid).emit('event:post_edited', result);
});
});
}); });
}; };

Loading…
Cancel
Save