Skip to content

Commit

Permalink
Don't rely on special author_id value for /r/promos.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsimpson63 committed Jun 11, 2015
1 parent 3c1267d commit 2321d4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions r2/r2/controllers/listingcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,10 @@ def query(self):
reddits._sort = desc('_downs')

if g.domain != 'reddit.com':
# don't try to render special subreddits (like promos)
reddits._filter(Subreddit.c.author_id != -1)
# don't try to render /r/promos on opensource installations
promo_sr_id = Subreddit.get_promote_srid()
if promo_sr_id:
reddits._filter(Subreddit.c._id != promo_sr_id)

if self.where == 'popular':
self.render_params = {"show_interestbar": True}
Expand Down
2 changes: 1 addition & 1 deletion r2/r2/lib/providers/search/cloudsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def fields(self, thing):
return SubredditFields(thing).fields()

def should_index(self, thing):
return getattr(thing, 'author_id', None) != -1
return thing._id != Subreddit.get_promote_srid()


def chunk_xml(xml, depth=0):
Expand Down
2 changes: 1 addition & 1 deletion r2/r2/lib/providers/search/solr.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def fields(self, thing):
return SubredditFields(thing).fields()

def should_index(self, thing):
return getattr(thing, 'author_id', None) != -1
return thing._id != Subreddit.get_promote_srid()


def _progress_key(item):
Expand Down

0 comments on commit 2321d4b

Please sign in to comment.