diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 26b1ca221..53aa13514 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -60,9 +60,7 @@ from r2.lib.promote import promote, unpromote, get_promoted def link_listing_by_url(url, count = None): """ - Generates a listing of links which share a common url, filtered by - the subreddit the current user is subscribed to (or the default - list of the user is not logged in.) + Generates a listing of links which share a common url """ try: links = list(tup(Link._by_url(url, sr = c.site))) @@ -72,10 +70,8 @@ def link_listing_by_url(url, count = None): except NotFound: links = () - user = c.user if c.user_is_loggedin else None - names = [l._fullname for l in links - if l.sr_id in Subreddit.user_subreddits(user, limit = None)] + names = [l._fullname for l in links] builder = IDBuilder(names, num = 25) return LinkListing(builder).listing() diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 426a3d4e6..08e6ccd9f 100644 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -477,12 +477,20 @@ class FrontController(RedditController): redirect_link = listing.things[0] # if there is more than one, check the users' subscriptions else: - infotext = strings.multiple_submitted % \ - listing.things[0].resubmit_link() - res = BoringPage(_("seen it"), - content = listing, - infotext = infotext).render() - return res + subscribed = [l for l in listing.things + if c.user_is_loggedin + and l.subreddit.is_subscriber_defaults(c.user)] + + #if there is only 1 link to be displayed, just go there + if len(subscribed) == 1: + redirect_link = subscribed[0] + else: + infotext = strings.multiple_submitted % \ + listing.things[0].resubmit_link() + res = BoringPage(_("seen it"), + content = listing, + infotext = infotext).render() + return res # we've found a link already. Redirect to its permalink page if redirect_link: