can mark topic unread for all

v1.18.x
Baris Soner Usakli 11 years ago
parent 25b50323fa
commit fd92d7b02a

@ -18,6 +18,7 @@
"link": "Link", "link": "Link",
"thread_tools.title": "Thread Tools", "thread_tools.title": "Thread Tools",
"thread_tools.markAsUnreadForAll": "Mark Unread",
"thread_tools.pin": "Pin Thread", "thread_tools.pin": "Pin Thread",
"thread_tools.lock": "Lock Thread", "thread_tools.lock": "Lock Thread",
"thread_tools.move": "Move Thread", "thread_tools.move": "Move Thread",

@ -88,6 +88,15 @@ define(['composer'], function(composer) {
return false; return false;
}); });
$('.markAsUnreadForAll').on('click', function() {
socket.emit('topics.markAsUnreadForAll', tid, function(err) {
if(err) {
return app.alertError(err.message);
}
});
return false;
})
moveThreadModal.on('shown.bs.modal', function() { moveThreadModal.on('shown.bs.modal', function() {
var loadingEl = document.getElementById('categories-loading'); var loadingEl = document.getElementById('categories-loading');

@ -146,6 +146,7 @@
<div class="btn-group thread-tools hide"> <div class="btn-group thread-tools hide">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button> <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" class="markAsUnreadForAll"><i class="fa fa-inbox"></i> [[topic:thread_tools.markAsUnreadForAll]]</a></li>
<li><a href="#" class="pin_thread"><i class="fa fa-thumb-tack"></i> [[topic:thread_tools.pin]]</a></li> <li><a href="#" class="pin_thread"><i class="fa fa-thumb-tack"></i> [[topic:thread_tools.pin]]</a></li>
<li><a href="#" class="lock_thread"><i class="fa fa-lock"></i> [[topic:thread_tools.lock]]</a></li> <li><a href="#" class="lock_thread"><i class="fa fa-lock"></i> [[topic:thread_tools.lock]]</a></li>
<li class="divider"></li> <li class="divider"></li>
@ -171,6 +172,7 @@
<div class="btn-group thread-tools hide"> <div class="btn-group thread-tools hide">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button> <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" class="markAsUnreadForAll"><i class="fa fa-inbox"></i> [[topic:thread_tools.markAsUnreadForAll]]</a></li>
<li><a href="#" class="pin_thread"><i class="fa fa-thumb-tack"></i> [[topic:thread_tools.pin]]</a></li> <li><a href="#" class="pin_thread"><i class="fa fa-thumb-tack"></i> [[topic:thread_tools.pin]]</a></li>
<li><a href="#" class="lock_thread"><i class="fa fa-lock"></i> [[topic:thread_tools.lock]]</a></li> <li><a href="#" class="lock_thread"><i class="fa fa-lock"></i> [[topic:thread_tools.lock]]</a></li>
<li class="divider"></li> <li class="divider"></li>

@ -83,6 +83,16 @@ SocketTopics.markAllRead = function(socket, data, callback) {
}); });
}; };
SocketTopics.markAsUnreadForAll = function(socket, tid, callback) {
topics.markAsUnreadForAll(tid, function(err) {
if(err) {
return callback(err);
}
topics.pushUnreadCount();
callback();
});
}
function doTopicAction(action, socket, tid, callback) { function doTopicAction(action, socket, tid, callback) {
if(!tid) { if(!tid) {
return callback(new Error('Invalid tid')); return callback(new Error('Invalid tid'));

Loading…
Cancel
Save