mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 19:36:41 +02:00
Merge branch 'master' of https://github.com/NodeBB/NodeBB
This commit is contained in:
@@ -18,6 +18,11 @@ define('forum/topic', [
|
||||
currentUrl = '';
|
||||
|
||||
$(window).on('action:ajaxify.start', function(ev, data) {
|
||||
if (Topic.replaceURLTimeout) {
|
||||
clearTimeout(Topic.replaceURLTimeout);
|
||||
Topic.replaceURLTimeout = 0;
|
||||
}
|
||||
|
||||
if (ajaxify.currentPage !== data.url) {
|
||||
navigator.disable();
|
||||
components.get('navbar/title').find('span').text('').hide();
|
||||
|
||||
@@ -118,6 +118,7 @@ define('forum/topic/events', [
|
||||
editedPostEl.html(data.post.content);
|
||||
editedPostEl.find('img:not(.not-responsive)').addClass('img-responsive');
|
||||
app.replaceSelfLinks(editedPostEl.find('a'));
|
||||
posts.wrapImagesInLinks(editedPostEl.parent());
|
||||
editedPostEl.fadeIn(250);
|
||||
$(window).trigger('action:posts.edited', data);
|
||||
});
|
||||
|
||||
@@ -217,15 +217,19 @@ define('forum/topic/posts', [
|
||||
utils.addCommasToNumbers(posts.find('.formatted-number'));
|
||||
utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));
|
||||
posts.find('.timeago').timeago();
|
||||
Posts.wrapImagesInLinks(posts);
|
||||
|
||||
addBlockquoteEllipses(posts.find('[component="post/content"] > blockquote > blockquote'));
|
||||
hidePostToolsForDeletedPosts(posts);
|
||||
};
|
||||
|
||||
Posts.wrapImagesInLinks = function(posts) {
|
||||
posts.find('[component="post/content"] img:not(.emoji)').each(function() {
|
||||
var $this = $(this);
|
||||
if (!$this.parent().is('a')) {
|
||||
$this.wrap('<a href="' + $this.attr('src') + '" target="_blank">');
|
||||
}
|
||||
});
|
||||
|
||||
addBlockquoteEllipses(posts.find('[component="post/content"] > blockquote > blockquote'));
|
||||
hidePostToolsForDeletedPosts(posts);
|
||||
};
|
||||
|
||||
Posts.showBottomPostBar = function() {
|
||||
|
||||
@@ -191,6 +191,9 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.categories.isAdminOrMod = function(cid, uid, callback) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(null, false);
|
||||
}
|
||||
helpers.some([
|
||||
function (next) {
|
||||
user.isModerator(uid, cid, next);
|
||||
|
||||
@@ -13,9 +13,6 @@ var favourites = require('../../favourites');
|
||||
module.exports = function(SocketPosts) {
|
||||
|
||||
SocketPosts.loadPostTools = function(socket, data, callback) {
|
||||
if (!socket.uid) {
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'))
|
||||
}
|
||||
@@ -37,7 +34,7 @@ module.exports = function(SocketPosts) {
|
||||
results.posts.tools = []; // TODO: add filter for this
|
||||
results.posts.deleted = parseInt(results.posts.deleted, 10) === 1;
|
||||
results.posts.favourited = results.favourited[0];
|
||||
results.posts.selfPost = socket.uid === parseInt(results.posts.uid, 10);
|
||||
results.posts.selfPost = socket.uid && socket.uid === parseInt(results.posts.uid, 10);
|
||||
results.posts.display_moderator_tools = results.isAdminOrMod || results.posts.selfPost;
|
||||
results.posts.display_move_tools = results.isAdminOrMod;
|
||||
callback(null, results);
|
||||
|
||||
Reference in New Issue
Block a user