expose recommended posts to everyone
This commit is contained in:
@@ -28,7 +28,12 @@ class UploadService
|
||||
|
||||
if preprocessor.completed?
|
||||
@upload = preprocessor.finish!
|
||||
create_post_from_upload(@upload)
|
||||
|
||||
begin
|
||||
create_post_from_upload(@upload)
|
||||
rescue Exception => x
|
||||
@upload.update(status: "error: #{x.class} - #{x.message}", backtrace: x.backtrace.join("\n"))
|
||||
end
|
||||
return @upload
|
||||
end
|
||||
|
||||
@@ -78,8 +83,6 @@ class UploadService
|
||||
@post = convert_to_post(upload)
|
||||
@post.save!
|
||||
|
||||
upload.update(status: "error: " + @post.errors.full_messages.join(", "))
|
||||
|
||||
if upload.context && upload.context["ugoira"]
|
||||
PixivUgoiraFrameData.create(
|
||||
post_id: @post.id,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<%= f.input :disable_cropped_thumbnails, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||
|
||||
<%= f.input :enable_recommended_posts, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||
<%#= f.input :enable_recommended_posts, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||
|
||||
<div class="input text optional field_with_hint">
|
||||
<label class="text optional" for="user_dmail_filter_attributes_words">Dmail filter</label>
|
||||
|
||||
Reference in New Issue
Block a user