mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
dont display post just scroll
This commit is contained in:
@@ -196,19 +196,20 @@ define('forum/topic', [
|
|||||||
function addParentHandler() {
|
function addParentHandler() {
|
||||||
components.get('topic').on('click', '[component="post/parent"]', function() {
|
components.get('topic').on('click', '[component="post/parent"]', function() {
|
||||||
var toPid = $(this).attr('data-topid');
|
var toPid = $(this).attr('data-topid');
|
||||||
var content = $(this).parents('[component="post"]').find('[component="post/parent/content"]');
|
|
||||||
if (!content.hasClass('hidden')) {
|
var toPost = $('[component="post"][data-pid="' + toPid + '"]');
|
||||||
return content.addClass('hidden');
|
if (toPost.length) {
|
||||||
} else if (content.html().length) {
|
return navigator.scrollToPost(toPost.attr('data-index'), true);
|
||||||
return content.removeClass('hidden');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.emit('posts.getPost', toPid, function(err, post) {
|
socket.emit('posts.getPidIndex', {pid: toPid, tid: ajaxify.data.tid, topicPostSort: config.topicPostSort}, function(err, index) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
content.html(post.content).removeClass('hidden');
|
if (utils.isNumber(index)) {
|
||||||
|
navigator.scrollToPost(index, true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,30 +145,6 @@ SocketPosts.getRawPost = function(socket, pid, callback) {
|
|||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketPosts.getPost = function(socket, pid, callback) {
|
|
||||||
async.waterfall([
|
|
||||||
function(next) {
|
|
||||||
privileges.posts.can('read', pid, socket.uid, next);
|
|
||||||
},
|
|
||||||
function(canRead, next) {
|
|
||||||
if (!canRead) {
|
|
||||||
return next(new Error('[[error:no-privileges]]'));
|
|
||||||
}
|
|
||||||
posts.getPostsByPids([pid], socket.uid, next);
|
|
||||||
},
|
|
||||||
function(postData, next) {
|
|
||||||
if (!postData.length) {
|
|
||||||
return next(new Error('[[error:no-post]]'));
|
|
||||||
}
|
|
||||||
postData = postData[0];
|
|
||||||
if (parseInt(postData.deleted, 10) === 1) {
|
|
||||||
return next(new Error('[[error:no-post]]'));
|
|
||||||
}
|
|
||||||
next(null, postData);
|
|
||||||
}
|
|
||||||
], callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
SocketPosts.getPrivileges = function(socket, pids, callback) {
|
SocketPosts.getPrivileges = function(socket, pids, callback) {
|
||||||
privileges.posts.get(pids, socket.uid, function(err, privileges) {
|
privileges.posts.get(pids, socket.uid, function(err, privileges) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user