expose recommended posts to everyone

This commit is contained in:
r888888888
2018-07-21 23:25:06 -07:00
committed by Albert Yi
parent a669fe361c
commit cc7a66438f
5 changed files with 28 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ class Post < ApplicationRecord
before_validation :parse_pixiv_id
before_validation :blank_out_nonexistent_parents
before_validation :remove_parent_loops
validates_uniqueness_of :md5, :on => :create
validates_uniqueness_of :md5, :on => :create, message: ->(obj, data) { "duplicate: #{Post.find_by_md5(obj.md5).id}"}
validates_inclusion_of :rating, in: %w(s q e), message: "rating must be s, q, or e"
validate :tag_names_are_valid
validate :added_tags_are_valid

View File

@@ -10,7 +10,7 @@ module RecommenderService
def available_for_post?(post)
return true if Rails.env.development?
enabled? && CurrentUser.enable_recommended_posts? && post.created_at > Date.civil(2017, 1, 1) && post.fav_count >= SCORE_THRESHOLD
enabled? && post.created_at > Date.civil(2017, 1, 1) && post.fav_count >= SCORE_THRESHOLD
end
def available_for_user?