Fix issue where only approved orgs could make CTAs (#1017)

* Fix issue where only approved orgs could make CTAs

* Adjust articles api
This commit is contained in:
Ben Halpern 2018-10-27 13:03:56 -04:00 committed by GitHub
parent db9c16db4d
commit f4f4af776c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -62,9 +62,11 @@ class OrganizationsController < ApplicationController
text_color_hex
twitter_username
github_username
cta_button_text
cta_button_url
cta_body_markdown
]
approved_params = %i(cta_button_text cta_button_url cta_body_markdown)
@organization&.approved ? accessible + approved_params : accessible
accessible
end
def organization_params

View file

@ -84,10 +84,10 @@ class ArticleApiIndexService
def state_articles(state)
if state == "fresh"
Article.where(published: true).
where("positive_reactions_count < ? AND featured_number > ?", 5, 7.hours.ago.to_i)
where("positive_reactions_count < ? AND featured_number > ? AND score > ?", 3, 7.hours.ago.to_i, -2)
elsif state == "rising"
Article.where(published: true).
where("positive_reactions_count > ? AND positive_reactions_count < ? AND featured_number > ?", 19, 27, 3.days.ago.to_i)
where("positive_reactions_count > ? AND positive_reactions_count < ? AND featured_number > ?", 19, 33, 3.days.ago.to_i)
end
end