mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
promoted links: Don't check link freshness in keep_items.
This makes it so that we no longer hide promoted links if the user has voted on them. This has been causing too much confusion.
This commit is contained in:
@@ -253,7 +253,8 @@ class HotController(FixListing, ListingController):
|
||||
|
||||
if link_ids:
|
||||
res = wrap_links(link_ids, wrapper=self.builder_wrapper,
|
||||
num=1, keep_fn=lambda x: x.fresh, skip=True)
|
||||
num=1, keep_fn=organic.keep_fresh_links,
|
||||
skip=True)
|
||||
res.parent_name = "promoted"
|
||||
if res.things:
|
||||
# store campaign id for tracking
|
||||
@@ -273,7 +274,6 @@ class HotController(FixListing, ListingController):
|
||||
pos = 0
|
||||
elif pos != 0:
|
||||
pos = pos % len(spotlight_links)
|
||||
spotlight_keep_fn = organic.keep_fresh_links
|
||||
num_links = organic.organic_length
|
||||
|
||||
# If prefs allow it, mix in promoted links and sr discovery content
|
||||
@@ -281,7 +281,6 @@ class HotController(FixListing, ListingController):
|
||||
if g.live_config['sr_discovery_links']:
|
||||
spotlight_links.extend(g.live_config['sr_discovery_links'])
|
||||
random.shuffle(spotlight_links)
|
||||
spotlight_keep_fn = lambda l: promote.is_promo(l) or organic.keep_fresh_links(l)
|
||||
num_links = len(spotlight_links)
|
||||
spotlight_links, pos, campaigns_by_link = promote.insert_promoted(spotlight_links,
|
||||
pos)
|
||||
@@ -308,7 +307,7 @@ class HotController(FixListing, ListingController):
|
||||
b = IDBuilder(disp_links,
|
||||
wrap = self.builder_wrapper,
|
||||
num = num_links,
|
||||
keep_fn = spotlight_keep_fn,
|
||||
keep_fn = organic.keep_fresh_links,
|
||||
skip = True)
|
||||
|
||||
try:
|
||||
|
||||
@@ -36,7 +36,17 @@ organic_length = 30
|
||||
organic_max_length= 50
|
||||
|
||||
def keep_fresh_links(item):
|
||||
return (c.user_is_loggedin and c.user._id == item.author_id) or item.fresh
|
||||
if c.user_is_loggedin and c.user._id == item.author_id:
|
||||
return True
|
||||
|
||||
if item._spam or item._deleted:
|
||||
return False
|
||||
|
||||
from r2.lib.promote import is_promo
|
||||
if is_promo(item):
|
||||
return True
|
||||
|
||||
return item.fresh
|
||||
|
||||
@memoize('cached_organic_links', time = organic_lifetime)
|
||||
def cached_organic_links(*sr_ids):
|
||||
|
||||
Reference in New Issue
Block a user