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:
Florence Yeun
2015-10-20 12:35:52 -07:00
committed by Matt Lee
parent 4c3c466ab8
commit 280eebc2a1
2 changed files with 9 additions and 3 deletions

View File

@@ -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).

View File

@@ -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",