Fix #4377: Save commentary by default.
Remove the "Include artist commentary" checkbox. Commentary is included by default unless the commentary fields are blank.
This commit is contained in:
@@ -77,7 +77,7 @@ class UploadService
|
||||
)
|
||||
end
|
||||
|
||||
if upload.include_artist_commentary
|
||||
if upload.has_commentary?
|
||||
@post.create_artist_commentary(
|
||||
:original_title => upload.artist_commentary_title,
|
||||
:original_description => upload.artist_commentary_desc,
|
||||
|
||||
@@ -233,6 +233,10 @@ class Upload < ApplicationRecord
|
||||
as_pending.to_s.truthy?
|
||||
end
|
||||
|
||||
def has_commentary?
|
||||
artist_commentary_title.present? || artist_commentary_desc.present? || translated_commentary_title.present? || translated_commentary_desc.present?
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
[:uploader, :post]
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ class UploadPolicy < ApplicationPolicy
|
||||
|
||||
def permitted_attributes
|
||||
%i[file source tag_string rating status parent_id artist_commentary_title
|
||||
artist_commentary_desc include_artist_commentary referer_url
|
||||
artist_commentary_desc referer_url
|
||||
md5_confirmation as_pending translated_commentary_title translated_commentary_desc]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
<div class="artist-commentary" style="display: none;">
|
||||
<%= f.input :artist_commentary_title, as: :string, label: "Original Title", input_html: { size: 60, value: params[:artist_commentary_title] } %>
|
||||
<%= f.input :artist_commentary_desc, as: :text, label: "Original Description", input_html: { size: "60x5", value: params[:artist_commentary_desc] } %>
|
||||
<%= f.input :include_artist_commentary, as: :boolean, label: "Include Commentary", input_html: { checked: params[:include_artist_commentary].present? } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user