Prevent post submission in a sticky thread. Close #664

This commit is contained in:
Nicolas Stepien 2013-02-23 15:56:44 +01:00
parent 4fc349d996
commit a796597108
3 changed files with 12 additions and 6 deletions

View File

@ -2512,9 +2512,10 @@
}, },
cooldown: { cooldown: {
start: function(e) { start: function(e) {
var fullID, seconds; var board, fullID, postID, seconds, _ref;
seconds = g.BOARD.ID === 'q' ? 600 : 30; _ref = e.detail, board = _ref.board, postID = _ref.postID;
fullID = "" + g.BOARD + "." + e.detail.postID; seconds = board.ID === 'q' ? 600 : 30;
fullID = "" + board + "." + postID;
return DeleteLink.cooldown.count(fullID, seconds, seconds); return DeleteLink.cooldown.count(fullID, seconds, seconds);
}, },
count: function(fullID, seconds, length) { count: function(fullID, seconds, length) {
@ -6339,6 +6340,8 @@
} else if (g.BOARD.ID === 'f' && filetag === '9999') { } else if (g.BOARD.ID === 'f' && filetag === '9999') {
err = 'Invalid tag specified.'; err = 'Invalid tag specified.';
} }
} else if (g.BOARD.threads[threadID].isSticky) {
err = 'You can\'t reply to this thread anymore.';
} else if (!(reply.com || reply.file)) { } else if (!(reply.com || reply.file)) {
err = 'No file selected.'; err = 'No file selected.';
} }

View File

@ -1341,12 +1341,13 @@ DeleteLink =
cooldown: cooldown:
start: (e) -> start: (e) ->
{board, postID} = e.detail
seconds = seconds =
if g.BOARD.ID is 'q' if board.ID is 'q'
600 600
else else
30 30
fullID = "#{g.BOARD}.#{e.detail.postID}" fullID = "#{board}.#{postID}"
DeleteLink.cooldown.count fullID, seconds, seconds DeleteLink.cooldown.count fullID, seconds, seconds
count: (fullID, seconds, length) -> count: (fullID, seconds, length) ->
return unless 0 <= seconds <= length return unless 0 <= seconds <= length

View File

@ -647,8 +647,10 @@ QR =
err = 'No file selected.' err = 'No file selected.'
else if g.BOARD.ID is 'f' and filetag is '9999' else if g.BOARD.ID is 'f' and filetag is '9999'
err = 'Invalid tag specified.' err = 'Invalid tag specified.'
else if g.BOARD.threads[threadID].isSticky
err = 'You can\'t reply to this thread anymore.'
else unless reply.com or reply.file else unless reply.com or reply.file
err = 'No file selected.' err = 'No file selected.'
if QR.captcha.isEnabled and !err if QR.captcha.isEnabled and !err
# get oldest valid captcha # get oldest valid captcha