Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
api: Allow multiple things to be passed to hide/unhide
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisst committed Jun 1, 2015
1 parent 8e5a907 commit e9d33b0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions r2/r2/controllers/api.py
Expand Up @@ -3084,32 +3084,36 @@ def POST_read_all_messages(self):
@require_oauth2_scope("report")
@noresponse(VUser(),
VModhash(),
thing = VByName('id', thing_cls=Link))
links=VByName('id', thing_cls=Link, multiple=True, limit=50))
@api_doc(api_section.links_and_comments)
def POST_hide(self, thing):
def POST_hide(self, links):
"""Hide a link.
This removes it from the user's default view of subreddit listings.
See also: [/api/unhide](#POST_api_unhide).
"""
if not thing: return
thing._hide(c.user)
if not links:
return abort(400)

LinkHidesByAccount._hide(c.user, links)

@require_oauth2_scope("report")
@noresponse(VUser(),
VModhash(),
thing = VByName('id'))
links=VByName('id', thing_cls=Link, multiple=True, limit=50))
@api_doc(api_section.links_and_comments)
def POST_unhide(self, thing):
def POST_unhide(self, links):
"""Unhide a link.
See also: [/api/hide](#POST_api_hide).
"""
if not thing: return
thing._unhide(c.user)
if not links:
return abort(400)

LinkHidesByAccount._unhide(c.user, links)


@csrf_exempt
Expand Down

0 comments on commit e9d33b0

Please sign in to comment.