posts/index: fix several "This tag is under discussion" issues.

Several fixes for the "This tag is under discussion" notice on the post
index page:

* Fix the notice appearing for BURs that aren't pending.
* Fix the notice never going away because of the cache never expiring.
* List all topics when a tag is involved in multiple BURs.
* Link to the forum post instead of the forum topic (fix #4421).
* Optimization: don't check for BURs when the search isn't a simple
  single tag search.
* Add a `tags` field to the bulk update requests table for tracking all
  tags involved in the request (excluding tags in mass updates that are
  negated/optional/wildcards). Known issue: doesn't handle tag type
  prefixes in mass updates correctly (e.g. `mass update foo -> artist:bar`
  doesn't detect the tag `bar`).
* Allow searching the /bulk_update_requests page by tags.

We don't really need to cache the notice here, but we do it anyway to
reduce queries on the post index page.
This commit is contained in:
evazion
2020-04-27 17:02:40 -05:00
parent 911ed34b76
commit d5a7fafca1
13 changed files with 80 additions and 81 deletions

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
require_relative "../../config/environment"
BulkUpdateRequest.transaction do
BulkUpdateRequest.find_each do |request|
request.tags = AliasAndImplicationImporter.new(request.script, nil).affected_tags
request.save!(validate: false)
puts "bur id=#{request.id} tags=#{request.tags}"
end
end