mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Api: Add another 'where' to user/where end point
This commit is contained in:
@@ -822,6 +822,13 @@ class UserController(ListingController):
|
||||
sr_id = self.savedsr._id if self.savedsr else None
|
||||
q = queries.get_saved(self.vuser, sr_id,
|
||||
category=self.savedcategory)
|
||||
elif self.where == 'actions':
|
||||
self.check_modified(self.vuser, 'actions')
|
||||
if not votes_visible(self.vuser):
|
||||
q = queries.get_overview(self.vuser, self.sort, self.time)
|
||||
else:
|
||||
q = queries.get_user_actions(self.vuser, 'new', 'all')
|
||||
|
||||
elif c.user_is_sponsor and self.where == 'promoted':
|
||||
q = queries.get_promoted_links(self.vuser._id)
|
||||
|
||||
@@ -857,10 +864,9 @@ class UserController(ListingController):
|
||||
if c.user_is_admin:
|
||||
c.referrer_policy = "always"
|
||||
|
||||
if self.sort in ('hot', 'new'):
|
||||
if self.sort in ('hot', 'new'):
|
||||
self.time = 'all'
|
||||
|
||||
|
||||
# hide spammers profile pages
|
||||
if vuser._spam and not vuser.banned_profile_visible:
|
||||
if (not c.user_is_loggedin or
|
||||
@@ -872,7 +878,7 @@ class UserController(ListingController):
|
||||
if where in ('liked', 'disliked') and not votes_visible(vuser):
|
||||
return self.abort403()
|
||||
|
||||
if ((where in ('saved', 'hidden') or
|
||||
if ((where in ('saved', 'hidden') or
|
||||
(where == 'gilded' and show == 'given')) and
|
||||
not (c.user_is_loggedin and c.user._id == vuser._id) and
|
||||
not c.user_is_admin):
|
||||
|
||||
@@ -528,6 +528,11 @@ def _get_submitted(user_id, sort, time):
|
||||
def get_submitted(user, sort, time):
|
||||
return _get_submitted(user._id, sort, time)
|
||||
|
||||
def get_user_actions(user, sort, time):
|
||||
return merge_results(get_comments(user, sort, time),
|
||||
get_submitted(user, sort, time),
|
||||
get_liked(user))
|
||||
|
||||
def get_overview(user, sort, time):
|
||||
return merge_results(get_comments(user, sort, time),
|
||||
get_submitted(user, sort, time))
|
||||
|
||||
Reference in New Issue
Block a user