@@ -331,6 +339,7 @@
parentID: '',
title: '',
description: '',
+ transcript: '',
rating: '',
error: '',
duplicateId: 0,
@@ -387,6 +396,7 @@
fillField('parentID', 'parent');
fillField('title', 'title');
fillField('description', 'description');
+ fillField('transcript', 'transcript');
fillTags();
fillRating();
if(params.has('sources')) {
@@ -421,6 +431,7 @@
data.append('upload[source]', this.sources.join('\n'));
data.append('upload[title]', this.title);
data.append('upload[description]', this.description);
+ data.append('upload[transcript]', this.transcript);
data.append('upload[parent_id]', this.parentID);
if (this.allowLockedTags)
data.append('upload[locked_tags]', this.lockedTags);
diff --git a/app/javascript/src/styles/specific/post_versions.scss b/app/javascript/src/styles/specific/post_versions.scss
index 970795b76..915bebea9 100644
--- a/app/javascript/src/styles/specific/post_versions.scss
+++ b/app/javascript/src/styles/specific/post_versions.scss
@@ -128,14 +128,25 @@ div#c-post-versions {
@include grid-border(right);
}
+ .pv-transcript-label {
+ grid-row: 1;
+ @include grid-col(9, 10);
+ }
+
+ .pv-transcript {
+ grid-row: 2;
+ @include grid-col(9, 10);
+ @include grid-border(right);
+ }
+
.pv-tags-locked-label {
grid-row: 1;
- @include grid-col(9, 13);
+ @include grid-col(10, 13);
}
.pv-tags-locked {
grid-row: 2;
- @include grid-col(9, 13);
+ @include grid-col(10, 13);
@include grid-border(right);
}
diff --git a/app/logical/elastic_post_query_builder.rb b/app/logical/elastic_post_query_builder.rb
index 17d909699..1ee0a68dc 100644
--- a/app/logical/elastic_post_query_builder.rb
+++ b/app/logical/elastic_post_query_builder.rb
@@ -110,6 +110,7 @@ class ElasticPostQueryBuilder < ElasticQueryBuilder
add_array_relation(:delreason, :del_reason, action: :wildcard)
add_array_relation(:title, :title, action: :match_phrase_prefix)
add_array_relation(:description, :description, action: :match_phrase_prefix)
+ add_array_relation(:transcript, :transcript, action: :match_phrase_prefix)
add_array_relation(:note, :notes, action: :match_phrase_prefix)
add_array_relation(:sources, :source, any_none_key: :source, action: :wildcard)
add_array_relation(:deleter, :deleter)
@@ -158,6 +159,10 @@ class ElasticPostQueryBuilder < ElasticQueryBuilder
(q[:hasdescription] ? must : must_not).push({exists: {field: :description}})
end
+ if q.include?(:hastranscript)
+ (q[:hastranscript] ? must : must_not).push({exists: {field: :transcript}})
+ end
+
if q.include?(:ischild)
(q[:ischild] ? must : must_not).push({exists: {field: :parent}})
end
diff --git a/app/logical/tag_query.rb b/app/logical/tag_query.rb
index 633bad8c0..00c513fda 100644
--- a/app/logical/tag_query.rb
+++ b/app/logical/tag_query.rb
@@ -8,11 +8,11 @@ class TagQuery
].freeze
BOOLEAN_METATAGS = %w[
- hassource hastitle hasdescription isparent ischild inpool pending_replacements artverified
+ hassource hastitle hasdescription hastranscript isparent ischild inpool pending_replacements artverified
].freeze
NEGATABLE_METATAGS = %w[
- id filetype type rating title description parent user user_id approver flagger deletedby delreason
+ id filetype type rating title description transcript parent user user_id approver flagger deletedby delreason
source status pool set fav favoritedby note locked upvote votedup downvote voteddown voted
width height mpixels ratio filesize duration score favcount date age change tagcount
commenter comm noter noteupdater
@@ -296,6 +296,9 @@ class TagQuery
when "description", "-description", "~description"
add_to_query(type, :description) { g2 }
+ when "transcript", "-transcript", "~transcript"
+ add_to_query(type, :transcript) { g2 }
+
when "note", "-note", "~note"
add_to_query(type, :note) { g2 }
diff --git a/app/logical/upload_service.rb b/app/logical/upload_service.rb
index c53c39a15..cb4f6ff2c 100644
--- a/app/logical/upload_service.rb
+++ b/app/logical/upload_service.rb
@@ -53,6 +53,7 @@ class UploadService
p.is_rating_locked = upload.locked_rating if upload.locked_rating.present?
p.title = upload.title.strip
p.description = upload.description.strip
+ p.transcript = upload.transcript.strip
p.md5 = upload.md5
p.file_ext = upload.file_ext
p.image_width = upload.image_width
diff --git a/app/models/post.rb b/app/models/post.rb
index 3f67140e7..bb46995a5 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -23,6 +23,7 @@ class Post < ApplicationRecord
validates :bg_color, format: { with: /\A[A-Fa-f0-9]{6}\z/ }, allow_nil: true
validates :title, length: { maximum: Danbooru.config.post_title_max_size }, if: :title_changed?
validates :description, length: { maximum: Danbooru.config.post_descr_max_size }, if: :description_changed?
+ validates :transcript, length: { maximum: Danbooru.config.post_trasc_max_size }, if: :transcript_changed?
validate :added_tags_are_valid, if: :should_process_tags?
validate :removed_tags_are_valid, if: :should_process_tags?
validate :has_artist_tag, if: :should_process_tags?
@@ -1174,6 +1175,7 @@ class Post < ApplicationRecord
id: id,
title: title,
description: description,
+ transcript: transcript,
md5: md5,
tags: tag_string,
height: image_height,
@@ -1323,7 +1325,7 @@ class Post < ApplicationRecord
end
def saved_change_to_watched_attributes?
- saved_change_to_rating? || saved_change_to_source? || saved_change_to_parent_id? || saved_change_to_tag_string? || saved_change_to_locked_tags? || saved_change_to_title? || saved_change_to_description?
+ saved_change_to_rating? || saved_change_to_source? || saved_change_to_parent_id? || saved_change_to_tag_string? || saved_change_to_locked_tags? || saved_change_to_title? || saved_change_to_description? || saved_change_to_transcript?
end
def create_new_version
@@ -1343,6 +1345,7 @@ class Post < ApplicationRecord
self.parent_id = target.parent_id
self.title = target.title
self.description = target.description
+ self.transcript = target.transcript
self.edit_reason = "Revert to version #{target.version}"
end
diff --git a/app/models/post_replacement.rb b/app/models/post_replacement.rb
index 565b6b582..b20027402 100644
--- a/app/models/post_replacement.rb
+++ b/app/models/post_replacement.rb
@@ -249,6 +249,7 @@ class PostReplacement < ApplicationRecord
parent_id: post.id,
title: post.title,
description: post.description,
+ transcript: post.transcript,
locked_tags: post.locked_tags,
replacement_id: self.id
}
diff --git a/app/models/post_version.rb b/app/models/post_version.rb
index 846fb128b..a5c3bdf59 100644
--- a/app/models/post_version.rb
+++ b/app/models/post_version.rb
@@ -39,6 +39,7 @@ class PostVersion < ApplicationRecord
locked_tags: post.locked_tags,
title: post.title,
description: post.description,
+ transcript: post.transcript,
reason: post.edit_reason
})
end
@@ -71,6 +72,7 @@ class PostVersion < ApplicationRecord
self.source_changed = prev.nil? || source != prev.try(:source)
self.title_changed = prev.nil? || title != prev.try(:title)
self.description_changed = prev.nil? || description != prev.try(:description)
+ self.transcript_changed = prev.nil? || transcript != prev.try(:transcript)
end
def tag_array
@@ -221,6 +223,10 @@ class PostVersion < ApplicationRecord
post.description = previous.description
end
+ if transcript_changed
+ post.transcript = previous.transcript
+ end
+
if rating_changed && !post.is_rating_locked?
post.rating = previous.rating
end
diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb
index de9f25995..c096cb689 100644
--- a/app/presenters/post_presenter.rb
+++ b/app/presenters/post_presenter.rb
@@ -150,6 +150,7 @@ class PostPresenter < Presenter
uploader_id: post.uploader_id,
title: post.title,
description: post.description,
+ transcript: post.transcript,
flags: {
pending: post.is_pending,
flagged: post.is_flagged,
diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rb
index 31a7e195c..f33f49ee4 100644
--- a/app/serializers/post_serializer.rb
+++ b/app/serializers/post_serializer.rb
@@ -139,5 +139,5 @@ class PostSerializer < ActiveModel::Serializer
attributes :id, :created_at, :updated_at, :file, :preview, :sample, :score, :tags, :locked_tags, :change_seq, :flags,
:rating, :fav_count, :sources, :pools, :relationships, :approver_id, :uploader_id, :title, :description,
- :comment_count, :is_favorited, :has_notes, :duration
+ :transcript, :comment_count, :is_favorited, :has_notes, :duration
end
diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb
index d384d590c..9f8f312e3 100644
--- a/app/views/post_versions/_listing.html.erb
+++ b/app/views/post_versions/_listing.html.erb
@@ -21,6 +21,9 @@
Description
+
+ Transcript
+
Locked Tags
@@ -70,6 +73,21 @@
Cleared
<% end %>
+ <% if post_version.transcript.present? %>
+
+ <%= post_version.transcript_changed ? "Show Transcript" : "No change" %>
+
+ <% elsif post_version.transcript_changed && post_version.version != 1%>
+
Cleared
+ <% end %>
+
diff --git a/app/views/post_versions/_search.html.erb b/app/views/post_versions/_search.html.erb
index f5c370fe9..dd0ddb717 100644
--- a/app/views/post_versions/_search.html.erb
+++ b/app/views/post_versions/_search.html.erb
@@ -6,6 +6,8 @@
<%= f.input :title_changed, label: "Title Changed", collection: [%w[Yes true], %w[No false]], include_blank: true %>
<%= f.input :description, label: "Description" %>
<%= f.input :description_changed, label: "Description Changed", collection: [%w[Yes true], %w[No false]], include_blank: true %>
+ <%= f.input :transcript, label: "Transcript" %>
+ <%= f.input :transcript_changed, label: "Transcript Changed", collection: [%w[Yes true], %w[No false]], include_blank: true %>
<%= f.input :rating_changed, label: "Rating Changed To", collection: rating_collection + [%w[Any any]], include_blank: true %>
<%= f.input :rating, label: "Final Rating", collection: rating_collection, include_blank: true %>
<%= f.input :parent_id, label: "Parent ID" %>
diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb
index a95628c72..3e8aaf03d 100644
--- a/app/views/posts/partials/show/_edit.html.erb
+++ b/app/views/posts/partials/show/_edit.html.erb
@@ -46,6 +46,8 @@
<%= f.input :description, as: :dtext, limit: Danbooru.config.post_descr_max_size, allow_color: true %>