mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
fix the bookmarklet to show you links from reddits you arent subscribed to
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user