Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Api: Add another 'where' to user/where end point

  • Loading branch information
chrisst committed Mar 31, 2015
1 parent 86ae369 commit 22625acedaa60af72d0f2b68f50eaaf91e556c01
Showing with 14 additions and 3 deletions.
  1. +9 −3 r2/r2/controllers/listingcontroller.py
  2. +5 −0 r2/r2/lib/db/queries.py
@@ -822,6 +822,13 @@ def query(self):
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 @@ def GET_listing(self, where, vuser, sort, time, show, **env):
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 @@ def GET_listing(self, where, vuser, sort, time, show, **env):
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))

0 comments on commit 22625ac

Please sign in to comment.
You can’t perform that action at this time.