diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index ea7afd4d3..9b7ccf4ba 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -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() diff --git a/r2/r2/lib/pages/things.py b/r2/r2/lib/pages/things.py index 056ac6aae..d3416c838 100644 --- a/r2/r2/lib/pages/things.py +++ b/r2/r2/lib/pages/things.py @@ -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