Prevent file upload in threads that reached the file limit.
Fix QR preventing from posting in sticky thread instead of locked thread.
This commit is contained in:
parent
4629864981
commit
3e211c8ba7
@ -3794,19 +3794,20 @@ ThreadStats =
|
||||
for ID, post of @posts
|
||||
postCount++
|
||||
fileCount++ if post.file
|
||||
ThreadStats.update postCount, fileCount
|
||||
ThreadStats.thread = @
|
||||
ThreadStats.update postCount, fileCount
|
||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||
$.add d.body, ThreadStats.dialog
|
||||
onUpdate: (e) ->
|
||||
return if e.detail[404]
|
||||
{postCount, fileCount, postLimit, fileLimit} = e.detail
|
||||
ThreadStats.update postCount, fileCount, postLimit, fileLimit
|
||||
update: (postCount, fileCount, postLimit, fileLimit) ->
|
||||
ThreadStats.postCountEl.textContent = postCount
|
||||
ThreadStats.fileCountEl.textContent = fileCount
|
||||
(if postLimit and !ThreadStats.thread.isSticky then $.addClass else $.rmClass) ThreadStats.postCountEl, 'warning'
|
||||
(if fileLimit and !ThreadStats.thread.isSticky then $.addClass else $.rmClass) ThreadStats.fileCountEl, 'warning'
|
||||
{postCount, fileCount} = e.detail
|
||||
ThreadStats.update postCount, fileCount
|
||||
update: (postCount, fileCount) ->
|
||||
{thread, postCountEl, fileCountEl} = ThreadStats
|
||||
postCountEl.textContent = postCount
|
||||
fileCountEl.textContent = fileCount
|
||||
(if thread.postLimit and !thread.isSticky then $.addClass else $.rmClass) postCountEl, 'warning'
|
||||
(if thread.fileLimit and !thread.isSticky then $.addClass else $.rmClass) fileCountEl, 'warning'
|
||||
|
||||
ThreadUpdater =
|
||||
init: ->
|
||||
@ -4010,6 +4011,8 @@ ThreadUpdater =
|
||||
|
||||
ThreadUpdater.updateThreadStatus 'Sticky', OP
|
||||
ThreadUpdater.updateThreadStatus 'Closed', OP
|
||||
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
||||
ThreadUpdater.thread.fileLimit = !!OP.imagelimit
|
||||
|
||||
nodes = [] # post container elements
|
||||
posts = [] # post objects
|
||||
@ -4085,8 +4088,6 @@ ThreadUpdater =
|
||||
deletedFiles: deletedFiles
|
||||
postCount: OP.replies + 1
|
||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
||||
postLimit: !!OP.bumplimit
|
||||
fileLimit: !!OP.imagelimit
|
||||
|
||||
ThreadWatcher =
|
||||
init: ->
|
||||
|
||||
@ -836,10 +836,12 @@ QR =
|
||||
err = 'New threads require a subject.'
|
||||
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
||||
err = 'No file selected.'
|
||||
else if g.BOARD.threads[threadID].isSticky
|
||||
else if g.BOARD.threads[threadID].isClosed
|
||||
err = 'You can\'t reply to this thread anymore.'
|
||||
else unless post.com or post.file
|
||||
err = 'No file selected.'
|
||||
else if post.file and g.BOARD.threads[threadID].fileLimit
|
||||
err = 'Max limit of image replies has been reached.'
|
||||
|
||||
if QR.captcha.isEnabled and !err
|
||||
{challenge, response} = QR.captcha.getOne()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user