Merge pull request #3445 from BrokenEagle/fix-3444
Fix #3444: Add validation warning for non-general/meta tags
This commit is contained in:
@@ -1744,6 +1744,7 @@ class Post < ApplicationRecord
|
||||
new_tags = added_tags.select { |t| t.post_count <= 1 }
|
||||
new_general_tags = new_tags.select { |t| t.category == Tag.categories.general }
|
||||
new_artist_tags = new_tags.select { |t| t.category == Tag.categories.artist }
|
||||
repopulated_tags = new_tags.select { |t| (t.category != Tag.categories.general) && (t.category != Tag.categories.meta) && (t.created_at < 1.hour.ago) }
|
||||
|
||||
if new_general_tags.present?
|
||||
n = new_general_tags.size
|
||||
@@ -1751,6 +1752,12 @@ class Post < ApplicationRecord
|
||||
self.warnings[:base] << "Created #{n} new #{n == 1 ? "tag" : "tags"}: #{tag_wiki_links.join(", ")}"
|
||||
end
|
||||
|
||||
if repopulated_tags.present?
|
||||
n = repopulated_tags.size
|
||||
tag_wiki_links = repopulated_tags.map { |tag| "[[#{tag.name}]]" }
|
||||
self.warnings[:base] << "Repopulated #{n} old #{n == 1 ? "tag" : "tags"}: #{tag_wiki_links.join(", ")}"
|
||||
end
|
||||
|
||||
new_artist_tags.each do |tag|
|
||||
if tag.artist.blank?
|
||||
self.warnings[:base] << "Artist [[#{tag.name}]] requires an artist entry. \"Create new artist entry\":[/artists/new?name=#{CGI::escape(tag.name)}]"
|
||||
|
||||
Reference in New Issue
Block a user