Tag change notices

This adds a small notice at the bottom of post searches if a single tag search is the target of any tag change request.
This commit is contained in:
Albert Yi
2019-01-14 18:14:27 -08:00
parent 60f0aeeb99
commit 1550538dc1
10 changed files with 143 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ class BulkUpdateRequest < ApplicationRecord
before_validation :initialize_attributes, :on => :create
before_validation :normalize_text
after_create :create_forum_topic
after_save :update_notice
scope :pending_first, -> { order(Arel.sql("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)")) }
scope :pending, -> {where(status: "pending")}
@@ -241,4 +242,11 @@ class BulkUpdateRequest < ApplicationRecord
def estimate_update_count
AliasAndImplicationImporter.new(script, nil).estimate_update_count
end
def update_notice
TagChangeNoticeService.update_cache(
AliasAndImplicationImporter.new(script, nil).affected_tags,
forum_topic_id
)
end
end