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
|
for ID, post of @posts
|
||||||
postCount++
|
postCount++
|
||||||
fileCount++ if post.file
|
fileCount++ if post.file
|
||||||
ThreadStats.update postCount, fileCount
|
|
||||||
ThreadStats.thread = @
|
ThreadStats.thread = @
|
||||||
|
ThreadStats.update postCount, fileCount
|
||||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||||
$.add d.body, ThreadStats.dialog
|
$.add d.body, ThreadStats.dialog
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
return if e.detail[404]
|
return if e.detail[404]
|
||||||
{postCount, fileCount, postLimit, fileLimit} = e.detail
|
{postCount, fileCount} = e.detail
|
||||||
ThreadStats.update postCount, fileCount, postLimit, fileLimit
|
ThreadStats.update postCount, fileCount
|
||||||
update: (postCount, fileCount, postLimit, fileLimit) ->
|
update: (postCount, fileCount) ->
|
||||||
ThreadStats.postCountEl.textContent = postCount
|
{thread, postCountEl, fileCountEl} = ThreadStats
|
||||||
ThreadStats.fileCountEl.textContent = fileCount
|
postCountEl.textContent = postCount
|
||||||
(if postLimit and !ThreadStats.thread.isSticky then $.addClass else $.rmClass) ThreadStats.postCountEl, 'warning'
|
fileCountEl.textContent = fileCount
|
||||||
(if fileLimit and !ThreadStats.thread.isSticky then $.addClass else $.rmClass) ThreadStats.fileCountEl, 'warning'
|
(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 =
|
ThreadUpdater =
|
||||||
init: ->
|
init: ->
|
||||||
@ -4010,6 +4011,8 @@ ThreadUpdater =
|
|||||||
|
|
||||||
ThreadUpdater.updateThreadStatus 'Sticky', OP
|
ThreadUpdater.updateThreadStatus 'Sticky', OP
|
||||||
ThreadUpdater.updateThreadStatus 'Closed', OP
|
ThreadUpdater.updateThreadStatus 'Closed', OP
|
||||||
|
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
||||||
|
ThreadUpdater.thread.fileLimit = !!OP.imagelimit
|
||||||
|
|
||||||
nodes = [] # post container elements
|
nodes = [] # post container elements
|
||||||
posts = [] # post objects
|
posts = [] # post objects
|
||||||
@ -4085,8 +4088,6 @@ ThreadUpdater =
|
|||||||
deletedFiles: deletedFiles
|
deletedFiles: deletedFiles
|
||||||
postCount: OP.replies + 1
|
postCount: OP.replies + 1
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
||||||
postLimit: !!OP.bumplimit
|
|
||||||
fileLimit: !!OP.imagelimit
|
|
||||||
|
|
||||||
ThreadWatcher =
|
ThreadWatcher =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
@ -836,10 +836,12 @@ QR =
|
|||||||
err = 'New threads require a subject.'
|
err = 'New threads require a subject.'
|
||||||
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
||||||
err = 'No file selected.'
|
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.'
|
err = 'You can\'t reply to this thread anymore.'
|
||||||
else unless post.com or post.file
|
else unless post.com or post.file
|
||||||
err = 'No file selected.'
|
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
|
if QR.captcha.isEnabled and !err
|
||||||
{challenge, response} = QR.captcha.getOne()
|
{challenge, response} = QR.captcha.getOne()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user