diff --git a/app/models/artist_url.rb b/app/models/artist_url.rb index e0f123de9..d77c2e12e 100644 --- a/app/models/artist_url.rb +++ b/app/models/artist_url.rb @@ -115,7 +115,7 @@ class ArtistUrl < ApplicationRecord def validate_url_format uri = Addressable::URI.parse(url) - errors[:url] << "must begin with http:// or https://" if !uri.scheme.in?(%w[http https]) + errors[:url] << " #{uri} must begin with http:// or https://" if !uri.scheme.in?(%w[http https]) rescue Addressable::URI::InvalidURIError => error errors[:url] << "is malformed: #{error}" end diff --git a/app/models/tag.rb b/app/models/tag.rb index 82c7a04b6..8ab7e0195 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -59,6 +59,11 @@ class Tag < ApplicationRecord end def increment_post_counts(tag_names) + if Rails.env.production? && tag_names.include?("breasts") + trace = Kernel.caller.grep(/danbooru/).reject {|x| x =~ /bundle/}.map {|x| x.sub(/\/var\/www\/danbooru2\/releases\/\d+\//, "")}.join("\n").slice(0, 4095) + ::NewRelic::Agent.record_custom_event("increment_post_counts", user_id: CurrentUser.id, pid: Process.pid, stacktrace: trace, hash: Cache.hash(tag_names)) + end + Tag.where(:name => tag_names).update_all("post_count = post_count + 1") end diff --git a/config/locales/en.yml b/config/locales/en.yml index 3674b8234..92c6e0b7b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,8 @@ en: hello: "Hello world" activerecord: attributes: + artist_url: + url: "" forum_post_vote: creator_id: "Your vote" post: