diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json
index 8df3a71ff2..b661f44872 100644
--- a/public/language/en_GB/topic.json
+++ b/public/language/en_GB/topic.json
@@ -26,6 +26,7 @@
"share": "Share",
"tools": "Tools",
"flag": "Flag",
+ "locked": "Locked",
"bookmark_instructions" : "Click here to return to your last position or close to discard.",
@@ -61,12 +62,6 @@
"thread_tools.purge": "Purge Topic",
"thread_tools.purge_confirm" : "Are you sure you want to purge this thread?",
- "topic_lock_success": "Topic has been successfully locked.",
- "topic_unlock_success": "Topic has been successfully unlocked.",
-
- "topic_pin_success": "Topic has been successfully pinned.",
- "topic_unpin_success": "Topic has been successfully unpinned.",
-
"topic_move_success": "This topic has been successfully moved to %1",
"post_delete_confirm": "Are you sure you want to delete this post?",
diff --git a/public/src/forum/topic/events.js b/public/src/forum/topic/events.js
index ea6eb6f86e..60d9e69dd4 100644
--- a/public/src/forum/topic/events.js
+++ b/public/src/forum/topic/events.js
@@ -1,7 +1,7 @@
'use strict';
-/* globals app, ajaxify, define, socket */
+/* globals app, ajaxify, define, socket, translator */
define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', 'forum/topic/threadTools'], function(browsing, postTools, threadTools) {
@@ -17,11 +17,11 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
'event:topic_restored': toggleTopicDeleteState,
'event:topic_purged': onTopicPurged,
- 'event:topic_locked': toggleTopicLockedState,
- 'event:topic_unlocked': toggleTopicLockedState,
+ 'event:topic_locked': threadTools.setLockedState,
+ 'event:topic_unlocked': threadTools.setLockedState,
- 'event:topic_pinned': toggleTopicPinnedState,
- 'event:topic_unpinned': toggleTopicPinnedState,
+ 'event:topic_pinned': threadTools.setPinnedState,
+ 'event:topic_unpinned': threadTools.setPinnedState,
'event:topic_moved': onTopicMoved,
@@ -78,18 +78,6 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
ajaxify.go('category/' + ajaxify.variables.get('category_id'));
}
- function toggleTopicLockedState(data) {
- threadTools.setLockedState(data);
-
- app.alertSuccess(data.isLocked ? '[[topic:topic_lock_success]]' : '[[topic:topic_unlock_success]]');
- }
-
- function toggleTopicPinnedState(data) {
- threadTools.setPinnedState(data);
-
- app.alertSuccess(data.isPinned ? '[[topic:topic_pin_success]]' : '[[topic:topic_unpin_success]]');
- }
-
function onTopicMoved(data) {
if (data && data.tid > 0) {
ajaxify.go('topic/' + data.tid);
diff --git a/public/src/forum/topic/threadTools.js b/public/src/forum/topic/threadTools.js
index c463aae2d4..30f2f11a66 100644
--- a/public/src/forum/topic/threadTools.js
+++ b/public/src/forum/topic/threadTools.js
@@ -104,14 +104,19 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
var threadEl = $('#post-container');
if (parseInt(data.tid, 10) === parseInt(threadEl.attr('data-tid'), 10)) {
var isLocked = data.isLocked && !app.isAdmin;
- translator.translate(' [[topic:thread_tools.' + (isLocked ? 'un': '') + 'lock]]', function(translated) {
+ translator.translate(' [[topic:thread_tools.' + (data.isLocked ? 'un': '') + 'lock]]', function(translated) {
$('.lock_thread').html(translated);
});
- threadEl.find('.post_reply').html(isLocked ? ' Locked' : ' Reply');
- threadEl.find('.quote, .edit, .delete').toggleClass('none', isLocked);
- $('.topic-main-buttons .post_reply').attr('disabled', isLocked).html(isLocked ? ' Locked' : 'Reply');
+ translator.translate(isLocked ? '[[topic:locked]]' : '[[topic:reply]]', function(translated) {
+ var className = isLocked ? 'fa-lock' : 'fa-reply';
+ threadEl.find('.post_reply').html(' ' + translated);
+ $('.topic-main-buttons .post_reply').attr('disabled', isLocked).html(isLocked ? ' ' + translated : translated);
+ });
+
+ threadEl.find('.quote, .edit, .delete').toggleClass('none', isLocked);
+ $('.topic-title i.fa-lock').toggleClass('hide', !data.isLocked);
ThreadTools.threadState.locked = data.isLocked;
}
};
@@ -144,9 +149,9 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
if (parseInt(data.tid, 10) === parseInt(threadEl.attr('data-tid'), 10)) {
translator.translate(' [[topic:thread_tools.' + (data.isPinned ? 'unpin' : 'pin') + ']]', function(translated) {
$('.pin_thread').html(translated);
-
ThreadTools.threadState.pinned = data.isPinned;
});
+ $('.topic-title i.fa-thumb-tack').toggleClass('hide', !data.isPinned);
}
}