mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-15 01:48:18 -05:00
Locking: Add locked attribute to api
Add boolean `locked` attribute to api json response. Add `/api/lock` and `/api/unlock` to api documentation.
This commit is contained in:
@@ -1407,8 +1407,11 @@ class ApiController(RedditController):
|
||||
VModhash(),
|
||||
VSrCanBan('id'),
|
||||
thing=VByName('id', thing_cls=Link))
|
||||
@api_doc(api_section.links_and_comments)
|
||||
def POST_lock(self, thing):
|
||||
"""Lock a comment thread.
|
||||
"""Lock a link.
|
||||
|
||||
Prevents a post from receiving new comments.
|
||||
|
||||
See also: [/api/unlock](#POST_api_unlock).
|
||||
|
||||
@@ -1426,14 +1429,16 @@ class ApiController(RedditController):
|
||||
ModAction.create(thing.subreddit_slow, c.user, target=thing,
|
||||
action='lock')
|
||||
|
||||
|
||||
@require_oauth2_scope("modposts")
|
||||
@noresponse(VUser(),
|
||||
VModhash(),
|
||||
VSrCanBan('id'),
|
||||
thing=VByName('id', thing_cls=Link))
|
||||
@api_doc(api_section.links_and_comments)
|
||||
def POST_unlock(self, thing):
|
||||
"""Unlock a comment thread.
|
||||
"""Unlock a link.
|
||||
|
||||
Allow a post to receive new comments.
|
||||
|
||||
See also: [/api/lock](#POST_api_lock).
|
||||
|
||||
|
||||
@@ -621,6 +621,7 @@ class LinkJsonTemplate(ThingJsonTemplate):
|
||||
likes="likes",
|
||||
link_flair_css_class="flair_css_class",
|
||||
link_flair_text="flair_text",
|
||||
locked="locked",
|
||||
media="media_object",
|
||||
media_embed="media_embed",
|
||||
num_comments="num_comments",
|
||||
|
||||
Reference in New Issue
Block a user