Skip to content

Node.js based forum software built for the modern web

removed thread state fix bottom bar class

barisusakli9dac6303bb80
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index 3e087879d2..14a3313f7b 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -30,12 +30,7 @@ define('forum/topic', [
});
Topic.init = function() {
- var tid = ajaxify.variables.get('topic_id'),
- thread_state = {
- locked: ajaxify.variables.get('locked'),
- deleted: ajaxify.variables.get('deleted'),
- pinned: ajaxify.variables.get('pinned')
- };
+ var tid = ajaxify.variables.get('topic_id');
$(window).trigger('action:topic.loading');
@@ -43,8 +38,8 @@ define('forum/topic', [
posts.processPage($('.topic'));
- postTools.init(tid, thread_state);
- threadTools.init(tid, thread_state);
+ postTools.init(tid);
+ threadTools.init(tid);
events.init();
sort.handleSort('topicPostSort', 'user.setTopicSort', 'topic/' + ajaxify.variables.get('topic_slug'));
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js
index 544b6dd897..4612a4f25e 100644
--- a/public/src/client/topic/postTools.js
+++ b/public/src/client/topic/postTools.js
@@ -7,10 +7,10 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
var PostTools = {},
topicName;
- PostTools.init = function(tid, threadState) {
+ PostTools.init = function(tid) {
topicName = ajaxify.variables.get('topic_name');
- addPostHandlers(tid, threadState);
+ addPostHandlers(tid);
share.addShareHandlers(topicName);
@@ -71,29 +71,19 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
}
}
- function addPostHandlers(tid, threadState) {
- function canPost() {
- return !threadState.locked || app.user.isAdmin;
- }
-
+ function addPostHandlers(tid) {
var postContainer = components.get('topic');
postContainer.on('click', '[component="post/quote"]', function() {
- if (canPost()) {
- onQuoteClicked($(this), tid, topicName);
- }
+ onQuoteClicked($(this), tid, topicName);
});
postContainer.on('click', '[component="post/reply"]', function() {
- if (canPost()) {
- onReplyClicked($(this), tid, topicName);
- }
+ onReplyClicked($(this), tid, topicName);
});
components.get('topic/reply').on('click', function() {
- if (canPost()) {
- onReplyClicked($(this), tid, topicName);
- }
+ onReplyClicked($(this), tid, topicName);
});
postContainer.on('click', '[component="post/favourite"]', function() {
diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js
index 1d7dcbe0df..0b8988bebf 100644
--- a/public/src/client/topic/posts.js
+++ b/public/src/client/topic/posts.js
@@ -267,7 +267,7 @@ define('forum/topic/posts', [
function showBottomPostBar() {
if(components.get('post').length > 1 || !components.get('post', 'index', 0).length) {
- $('.bottom-post-bar').removeClass('hide');
+ $('.bottom-post-bar').removeClass('hidden');
}
}
diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js
index 6cf70b112c..3bf8d539b2 100644
--- a/public/src/client/topic/threadTools.js
+++ b/public/src/client/topic/threadTools.js
@@ -6,9 +6,7 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
var ThreadTools = {};
- ThreadTools.init = function(tid, threadState) {
- ThreadTools.threadState = threadState;
-
+ ThreadTools.init = function(tid) {
components.get('topic/delete').on('click', function() {
topicCommand('delete', tid);
return false;
@@ -118,7 +116,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
threadEl.find('[component="post/reply"], [component="post/quote"], [component="post/edit"], [component="post/delete"]').toggleClass('hidden', isLocked);
$('[component="post/header"] i.fa-lock').toggleClass('hidden', !data.isLocked);
- ThreadTools.threadState.locked = data.isLocked;
};
ThreadTools.setDeleteState = function(data) {
@@ -133,7 +130,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
components.get('topic/deleted/message').toggleClass('hidden', !data.isDelete);
threadEl.toggleClass('deleted', data.isDelete);
- ThreadTools.threadState.deleted = data.isDelete;
};
ThreadTools.setPinnedState = function(data) {
@@ -142,7 +138,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
return;
}
- ThreadTools.threadState.pinned = data.isPinned;
components.get('topic/pin').toggleClass('hidden', data.isPinned);
components.get('topic/unpin').toggleClass('hidden', !data.isPinned);
$('[component="post/header"] i.fa-thumb-tack').toggleClass('hidden', !data.isPinned);