mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
OAuth: add new "history" and "save" scopes
history: gives access to voting history, saved and hidden save: allows save/unsave for submissions and comments
This commit is contained in:
committed by
Neil Williams
parent
0265142711
commit
31459b18f7
@@ -2152,6 +2152,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
sr = thing.subreddit_slow
|
||||
ModAction.create(sr, c.user, 'distinguish', target=thing, **log_kw)
|
||||
|
||||
@require_oauth2_scope("save")
|
||||
@noresponse(VUser(),
|
||||
VModhash(),
|
||||
thing = VByName('id'))
|
||||
@@ -2168,6 +2169,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
if isinstance(thing, Comment) and not c.user.gold: return
|
||||
r = thing._save(c.user)
|
||||
|
||||
@require_oauth2_scope("save")
|
||||
@noresponse(VUser(),
|
||||
VModhash(),
|
||||
thing = VByName('id'))
|
||||
|
||||
@@ -654,6 +654,7 @@ class UserController(ListingController):
|
||||
|
||||
return q
|
||||
|
||||
@require_oauth2_scope("history")
|
||||
@validate(vuser = VExistingUname('username'),
|
||||
sort = VMenu('sort', ProfileSortMenu, remember = False),
|
||||
time = VMenu('t', TimeMenu, remember = False))
|
||||
|
||||
@@ -105,6 +105,13 @@ class OAuth2Scope:
|
||||
"name": _("Edit Posts"),
|
||||
"description": _("Edit and delete my comments and submissions."),
|
||||
},
|
||||
"history": {
|
||||
"id": "history",
|
||||
"name": _("History"),
|
||||
"description": _(
|
||||
"Access my voting history and comments or submissions I've"
|
||||
" saved or hidden."),
|
||||
},
|
||||
"identity": {
|
||||
"id": "identity",
|
||||
"name": _("My Identity"),
|
||||
@@ -159,6 +166,11 @@ class OAuth2Scope:
|
||||
"name": _("Read Content"),
|
||||
"description": _("Access posts and comments through my account."),
|
||||
},
|
||||
"save": {
|
||||
"id": "save",
|
||||
"name": _("Save Content"),
|
||||
"description": _("Save and unsave comments and submissions."),
|
||||
},
|
||||
"submit": {
|
||||
"id": "submit",
|
||||
"name": _("Submit Content"),
|
||||
|
||||
Reference in New Issue
Block a user