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:
David Wick
2015-12-07 14:34:25 -08:00
parent 88ebd9431e
commit edc8ea86f7

View File

@@ -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)