mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
srnames_from_site: Allow use of subscriptions as to be configurable
This allows display to reuse this function without changing the current behavior.
This commit is contained in:
@@ -977,7 +977,7 @@ def get_nsfw_collections_srnames():
|
||||
return set(srnames)
|
||||
|
||||
|
||||
def srnames_from_site(user, site):
|
||||
def srnames_from_site(user, site, include_subscriptions=True):
|
||||
is_logged_in = user and not isinstance(user, FakeAccount)
|
||||
srnames = set()
|
||||
|
||||
@@ -988,7 +988,7 @@ def srnames_from_site(user, site):
|
||||
else:
|
||||
srnames.add(Frontpage.name)
|
||||
|
||||
if is_logged_in:
|
||||
if is_logged_in and include_subscriptions:
|
||||
subscriptions = Subreddit.user_subreddits(
|
||||
user,
|
||||
ids=False,
|
||||
@@ -1019,8 +1019,11 @@ def srnames_from_site(user, site):
|
||||
return srnames
|
||||
|
||||
|
||||
def srnames_with_live_promos(user, site):
|
||||
site_srnames = srnames_from_site(user, site)
|
||||
def srnames_with_live_promos(user, site, include_subscriptions=True):
|
||||
site_srnames = srnames_from_site(
|
||||
user, site,
|
||||
include_subscriptions=True,
|
||||
)
|
||||
promo_srnames = all_live_promo_srnames()
|
||||
return promo_srnames.intersection(site_srnames)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user