mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Locking: Remove for archived posts
Do not allow archived posts to be locked or unlocked, since they cannot receive new comments or votes.
This commit is contained in:
@@ -1457,6 +1457,9 @@ class ApiController(RedditController):
|
||||
subreddit=thing.subreddit_slow.name):
|
||||
abort(404, 'not found')
|
||||
|
||||
if thing.archived:
|
||||
return abort(400, "Bad Request")
|
||||
|
||||
thing.locked = True
|
||||
thing._commit()
|
||||
|
||||
@@ -1480,6 +1483,9 @@ class ApiController(RedditController):
|
||||
subreddit=thing.subreddit_slow.name):
|
||||
abort(404, 'not found')
|
||||
|
||||
if thing.archived:
|
||||
return abort(400, "Bad Request")
|
||||
|
||||
thing.locked = False
|
||||
thing._commit()
|
||||
|
||||
|
||||
@@ -97,8 +97,9 @@ class LinkButtons(PrintableButtons):
|
||||
editable = is_author and thing_editable and not thing_takendown
|
||||
|
||||
show_lock = show_unlock = False
|
||||
if thing.can_ban and feature.is_enabled('thread_locking',
|
||||
subreddit=thing.subreddit.name):
|
||||
lockable = thing.can_ban and not thing.archived
|
||||
if (lockable and feature.is_enabled('thread_locking',
|
||||
subreddit=thing.subreddit.name)):
|
||||
show_lock = not thing.locked
|
||||
show_unlock = not show_lock
|
||||
|
||||
|
||||
Reference in New Issue
Block a user