mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-03 14:20:33 +01:00
decided to go ahead and deprecate this for 0.7x instead of post-0.7x
This commit is contained in:
22
NOTES.md
22
NOTES.md
@@ -1,22 +0,0 @@
|
||||
Deprecation TODO's for post - 0.7x
|
||||
======================================
|
||||
|
||||
- public/src/components.js: remove pre-0.7x compatibility code
|
||||
- public/src/client/topic/postTools.js: remove selectors for every post button (ex. ".edit")
|
||||
- remove all pre-0.7x compatibility selectors for:
|
||||
Topics -
|
||||
.post-content
|
||||
.topic-title
|
||||
.post_reply
|
||||
.edit
|
||||
.delete
|
||||
.purge
|
||||
.move
|
||||
.reply
|
||||
.quote
|
||||
.chat
|
||||
.flag
|
||||
.thread_active_users
|
||||
.browsing-users
|
||||
.thread_active_users
|
||||
.user-count
|
||||
@@ -55,7 +55,7 @@ define('forum/category', [
|
||||
navigator.init('#topics-container > .category-item', ajaxify.variables.get('topic_count'), Category.toTop, Category.toBottom, Category.navigatorCallback);
|
||||
}
|
||||
|
||||
$('#topics-container').on('click', '[component="post/header"], .topic-title', function() {
|
||||
$('#topics-container').on('click', '[component="post/header"]', function() {
|
||||
var clickedIndex = $(this).parents('[data-index]').attr('data-index');
|
||||
$('#topics-container li.category-item').each(function(index, el) {
|
||||
if ($(el).offset().top - $(window).scrollTop() > 0) {
|
||||
|
||||
@@ -10,7 +10,7 @@ define('forum/topic/browsing', function() {
|
||||
|
||||
Browsing.onUpdateUsersInRoom = function(data) {
|
||||
if (data && data.room.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) {
|
||||
$('.thread_active_users-users, [component="topic/browsing/list"]').parent().toggleClass('hidden', !data.users.length);
|
||||
$('[component="topic/browsing/list"]').parent().toggleClass('hidden', !data.users.length);
|
||||
for(var i=0; i<data.users.length; ++i) {
|
||||
addUserIcon(data.users[i]);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ define('forum/topic/browsing', function() {
|
||||
};
|
||||
|
||||
Browsing.onUserEnter = function(data) {
|
||||
var activeEl = $('.thread_active_users, [component="topic/browsing/list"]');
|
||||
var activeEl = $('[component="topic/browsing/list"]');
|
||||
var user = activeEl.find('a[data-uid="' + data.uid + '"]');
|
||||
if (!user.length && activeEl.first().children().length < 10) {
|
||||
addUserIcon(data);
|
||||
@@ -35,7 +35,7 @@ define('forum/topic/browsing', function() {
|
||||
if (app.user.uid === parseInt(uid, 10)) {
|
||||
return;
|
||||
}
|
||||
var user = $('.thread_active_users, [component="topic/browsing/list"]').find('a[data-uid="' + uid + '"]');
|
||||
var user = $('[component="topic/browsing/list"]').find('a[data-uid="' + uid + '"]');
|
||||
if (user.length) {
|
||||
var count = Math.max(0, parseInt(user.attr('data-count'), 10) - 1);
|
||||
user.attr('data-count', count);
|
||||
@@ -63,7 +63,7 @@ define('forum/topic/browsing', function() {
|
||||
}
|
||||
|
||||
function updateBrowsingUsers(data) {
|
||||
var activeEl = $('.thread_active_users, [component="topic/browsing/list"]');
|
||||
var activeEl = $('[component="topic/browsing/list"]');
|
||||
var user = activeEl.find('a[data-uid="'+ data.uid + '"]');
|
||||
if (user.length && data.status === 'offline') {
|
||||
user.parent().remove();
|
||||
@@ -74,7 +74,7 @@ define('forum/topic/browsing', function() {
|
||||
if (!user.userslug) {
|
||||
return;
|
||||
}
|
||||
var activeEl = $('.thread_active_users, [component="topic/browsing/list"]');
|
||||
var activeEl = $('[component="topic/browsing/list"]');
|
||||
var userEl = createUserIcon(user.uid, user.picture, user.userslug, user.username);
|
||||
var isSelf = parseInt(user.uid, 10) === parseInt(app.user.uid, 10);
|
||||
if (isSelf) {
|
||||
@@ -89,7 +89,7 @@ define('forum/topic/browsing', function() {
|
||||
}
|
||||
|
||||
function createUserIcon(uid, picture, userslug, username) {
|
||||
if(!$('.thread_active_users, [component="topic/browsing/list"]').find('[data-uid="' + uid + '"]').length) {
|
||||
if(!$('[component="topic/browsing/list"]').find('[data-uid="' + uid + '"]').length) {
|
||||
return $('<div class="inline-block"><a data-uid="' + uid + '" data-count="1" href="' + config.relative_path + '/user/' + userslug + '"><img title="' + username + '" src="'+ picture +'"/></a></div>');
|
||||
}
|
||||
}
|
||||
@@ -99,11 +99,11 @@ define('forum/topic/browsing', function() {
|
||||
if (!count || count < 0) {
|
||||
count = 0;
|
||||
}
|
||||
$('.user-count, [component="topic/browsing/count"]').text(count).parent().toggleClass('hidden', count === 0);
|
||||
$('[component="topic/browsing/count"]').text(count).parent().toggleClass('hidden', count === 0);
|
||||
}
|
||||
|
||||
function increaseUserCount(incr) {
|
||||
updateUserCount(parseInt($('.user-count, [component="topic/browsing/count"]').first().text(), 10) + incr);
|
||||
updateUserCount(parseInt($('[component="topic/browsing/count"]').first().text(), 10) + incr);
|
||||
}
|
||||
|
||||
return Browsing;
|
||||
|
||||
@@ -159,9 +159,9 @@ define('forum/topic/events', [
|
||||
|
||||
if (!app.user.isAdmin && parseInt(data.uid, 10) !== parseInt(app.user.uid, 10)) {
|
||||
if (isDeleted) {
|
||||
postEl.find('[component="post/content"], .post-content').translateHtml('[[topic:post_is_deleted]]');
|
||||
postEl.find('[component="post/content"]').translateHtml('[[topic:post_is_deleted]]');
|
||||
} else {
|
||||
postEl.find('[component="post/content"], .post-content').html(data.content);
|
||||
postEl.find('[component="post/content"]').html(data.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,12 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com
|
||||
PostTools.toggle = function(pid, isDeleted) {
|
||||
var postEl = components.get('post', 'pid', pid);
|
||||
|
||||
postEl.find('.quote, .favourite, .post_reply, .chat, .flag').toggleClass('hidden', isDeleted);
|
||||
postEl.find('.purge').toggleClass('hidden', !isDeleted);
|
||||
postEl.find('.delete .i').toggleClass('fa-trash-o', !isDeleted).toggleClass('fa-history', isDeleted);
|
||||
postEl.find('.delete span').translateHtml(isDeleted ? ' [[topic:restore]]' : ' [[topic:delete]]');
|
||||
postEl.find('[component="post/quote"], [component="post/favourite"], [component="post/reply"], [component="post/flag"], [component="user/chat"]')
|
||||
.toggleClass('hidden', isDeleted);
|
||||
|
||||
postEl.find('[component="post/purge"]').toggleClass('hidden', !isDeleted);
|
||||
postEl.find('[component="post/delete"] .i').toggleClass('fa-trash-o', !isDeleted).toggleClass('fa-history', isDeleted);
|
||||
postEl.find('[component="post/delete"] span').translateHtml(isDeleted ? ' [[topic:restore]]' : ' [[topic:delete]]');
|
||||
};
|
||||
|
||||
PostTools.updatePostCount = function() {
|
||||
@@ -78,55 +80,55 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com
|
||||
* Use the components system instead.
|
||||
*/
|
||||
|
||||
postContainer.on('click', '.quote, [component="post/quote"]', function() {
|
||||
postContainer.on('click', '[component="post/quote"]', function() {
|
||||
if (!threadState.locked) {
|
||||
onQuoteClicked($(this), tid, topicName);
|
||||
}
|
||||
});
|
||||
|
||||
postContainer.on('click', '.post_reply, [component="post/reply"]', function() {
|
||||
postContainer.on('click', '[component="post/reply"]', function() {
|
||||
if (!threadState.locked) {
|
||||
onReplyClicked($(this), tid, topicName);
|
||||
}
|
||||
});
|
||||
|
||||
postContainer.on('click', '.favourite, [component="post/favourite"]', function() {
|
||||
postContainer.on('click', '[component="post/favourite"]', function() {
|
||||
favouritePost($(this), getData($(this), 'data-pid'));
|
||||
});
|
||||
|
||||
postContainer.on('click', '.upvote, [component="post/upvote"]', function() {
|
||||
postContainer.on('click', '[component="post/upvote"]', function() {
|
||||
return toggleVote($(this), '.upvoted', 'posts.upvote');
|
||||
});
|
||||
|
||||
postContainer.on('click', '.downvote, [component="post/downvote"]', function() {
|
||||
postContainer.on('click', '[component="post/downvote"]', function() {
|
||||
return toggleVote($(this), '.downvoted', 'posts.downvote');
|
||||
});
|
||||
|
||||
postContainer.on('click', '.votes, [component="post/vote-count"]', function() {
|
||||
postContainer.on('click', '[component="post/vote-count"]', function() {
|
||||
showVotes(getData($(this), 'data-pid'));
|
||||
});
|
||||
|
||||
postContainer.on('click', '.flag, [component="post/flag"]', function() {
|
||||
postContainer.on('click', '[component="post/flag"]', function() {
|
||||
flagPost(getData($(this), 'data-pid'));
|
||||
});
|
||||
|
||||
postContainer.on('click', '.edit, [component="post/edit"]', function(e) {
|
||||
postContainer.on('click', '[component="post/edit"]', function(e) {
|
||||
composer.editPost(getData($(this), 'data-pid'));
|
||||
});
|
||||
|
||||
postContainer.on('click', '.delete, [component="post/delete"]', function(e) {
|
||||
postContainer.on('click', '[component="post/delete"]', function(e) {
|
||||
deletePost($(this), tid);
|
||||
});
|
||||
|
||||
postContainer.on('click', '.purge, [component="post/purge"]', function(e) {
|
||||
postContainer.on('click', '[component="post/purge"]', function(e) {
|
||||
purgePost($(this), tid);
|
||||
});
|
||||
|
||||
postContainer.on('click', '.move, [component="post/move"]', function(e) {
|
||||
postContainer.on('click', '[component="post/move"]', function(e) {
|
||||
openMovePostModal($(this));
|
||||
});
|
||||
|
||||
postContainer.on('click', '.chat, [component="user/chat"]', function(e) {
|
||||
postContainer.on('click', '[component="user/chat"]', function(e) {
|
||||
openChat($(this));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -168,14 +168,14 @@ define('forum/topic/posts', [
|
||||
isSelfPost = parseInt(postEl.attr('data-uid'), 10) === parseInt(app.user.uid, 10);
|
||||
|
||||
if (!privileges.editable) {
|
||||
postEl.find('.edit, .delete, .purge, [component="post/edit"], [component="post/delete"], [component="post/purge"]').remove();
|
||||
postEl.find('[component="post/edit"], [component="post/delete"], [component="post/purge"]').remove();
|
||||
}
|
||||
|
||||
if (!privileges.move) {
|
||||
postEl.find('.move, [component="post/move"]').remove();
|
||||
postEl.find('[component="post/move"]').remove();
|
||||
}
|
||||
|
||||
postEl.find('.chat, .flag, [component="user/chat"], [component="post/flag"]').toggleClass('hidden', isSelfPost || !app.user.uid);
|
||||
postEl.find('[component="user/chat"], [component="post/flag"]').toggleClass('hidden', isSelfPost || !app.user.uid);
|
||||
}
|
||||
|
||||
Posts.loadMorePosts = function(direction) {
|
||||
@@ -226,14 +226,14 @@ define('forum/topic/posts', [
|
||||
utils.addCommasToNumbers(element.find('.formatted-number'));
|
||||
utils.makeNumbersHumanReadable(element.find('.human-readable-number'));
|
||||
element.find('.timeago').timeago();
|
||||
element.find('[component="post/content"] img:not(.emoji), .post-content img:not(.emoji)').addClass('img-responsive').each(function() {
|
||||
element.find('[component="post/content"] img:not(.emoji)').addClass('img-responsive').each(function() {
|
||||
var $this = $(this);
|
||||
if (!$this.parent().is('a')) {
|
||||
$this.wrap('<a href="' + $this.attr('src') + '" target="_blank">');
|
||||
}
|
||||
});
|
||||
postTools.updatePostCount();
|
||||
addBlockquoteEllipses(element.find('[component="post/content"] > blockquote, .post-content > blockquote'));
|
||||
addBlockquoteEllipses(element.find('[component="post/content"] > blockquote'));
|
||||
hidePostToolsForDeletedPosts(element);
|
||||
showBottomPostBar();
|
||||
};
|
||||
|
||||
@@ -105,12 +105,12 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
|
||||
|
||||
translator.translate(isLocked ? '[[topic:locked]]' : '[[topic:reply]]', function(translated) {
|
||||
var className = isLocked ? 'fa-lock' : 'fa-reply';
|
||||
threadEl.find('.post_reply, [component="post/reply"]').html('<i class="fa ' + className + '"></i> ' + translated);
|
||||
$('.post_reply, [component="post/reply"]').attr('disabled', isLocked).html(isLocked ? '<i class="fa fa-lock"></i> ' + translated : translated);
|
||||
threadEl.find('[component="post/reply"]').html('<i class="fa ' + className + '"></i> ' + translated);
|
||||
$('[component="post/reply"]').attr('disabled', isLocked).html(isLocked ? '<i class="fa fa-lock"></i> ' + translated : translated);
|
||||
});
|
||||
|
||||
threadEl.find('.quote, .edit, .delete').toggleClass('hidden', isLocked);
|
||||
$('[component="post/header"] i.fa-lock, .topic-title i.fa-lock').toggleClass('hide', !data.isLocked);
|
||||
threadEl.find('[component="quote"], [component="edit"], [component="delete"]').toggleClass('hidden', isLocked);
|
||||
$('[component="post/header"] i.fa-lock').toggleClass('hide', !data.isLocked);
|
||||
ThreadTools.threadState.locked = data.isLocked;
|
||||
}
|
||||
};
|
||||
@@ -144,7 +144,7 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
|
||||
components.get('topic/pin').html(translated);
|
||||
ThreadTools.threadState.pinned = data.isPinned;
|
||||
});
|
||||
$('[component="post/header"] i.fa-thumb-tack, .topic-title i.fa-thumb-tack').toggleClass('hide', !data.isPinned);
|
||||
$('[component="post/header"] i.fa-thumb-tack').toggleClass('hide', !data.isPinned);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,33 +8,26 @@ var components = components || {};
|
||||
return $('[data-' + name + '="' + value + '"]');
|
||||
},
|
||||
'post/content': function(pid) {
|
||||
var el = components.core.post('pid', pid).find('[component="post/content"]');
|
||||
return el.length ? el : $('#content_' + pid); // deprecated after 0.7x
|
||||
return components.core.post('pid', pid).find('[component="post/content"]');
|
||||
},
|
||||
'post/header': function(pid) {
|
||||
var el = components.core.post('pid', pid).find('[component="post/header"]');
|
||||
return el.length ? el : $('#topic_title_' + pid); // deprecated after 0.7x
|
||||
return components.core.post('pid', pid).find('[component="post/header"]');
|
||||
},
|
||||
'post/anchor': function(index) {
|
||||
var el = components.core.post('index', index).find('[component="post/anchor"]');
|
||||
return el.length ? el : $('#post_anchor_' + index); // deprecated after 0.7x
|
||||
return components.core.post('index', index).find('[component="post/anchor"]');
|
||||
},
|
||||
'post/vote-count': function(pid) {
|
||||
var el = components.core.post('pid', pid).find('[component="post/vote-count"]');
|
||||
return el.length ? el : components.core.post('pid', pid).find('.votes'); // deprecated after 0.7x
|
||||
return components.core.post('pid', pid).find('[component="post/vote-count"]');
|
||||
},
|
||||
'post/favourite-count': function(pid) {
|
||||
var el = components.core.post('pid', pid).find('[component="post/favourite-count"]');
|
||||
return el.length ? el : components.core.post('pid', pid).find('.favouriteCount'); // deprecated after 0.7x
|
||||
return components.core.post('pid', pid).find('[component="post/favourite-count"]');
|
||||
},
|
||||
|
||||
'user/postcount': function(uid) {
|
||||
var el = $('[component="user/postcount"][data-uid="' + uid + '"]');
|
||||
return el.length ? el : $('.user_postcount_' + uid); // deprecated after 0.7x
|
||||
return $('[component="user/postcount"][data-uid="' + uid + '"]');
|
||||
},
|
||||
'user/reputation': function(uid) {
|
||||
var el = $('[component="user/reputation"][data-uid="' + uid + '"]');
|
||||
return el.length ? el : $('.reputation[data-uid="' + uid + '"]'); // deprecated after 0.7x
|
||||
return $('[component="user/reputation"][data-uid="' + uid + '"]');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user