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

@@ -669,7 +669,8 @@ CREATE TABLE public.bulk_update_requests (
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
approver_id integer,
forum_post_id integer
forum_post_id integer,
tags text[] DEFAULT '{}'::text[] NOT NULL
);
@@ -4732,6 +4733,13 @@ CREATE INDEX index_bans_on_user_id ON public.bans USING btree (user_id);
CREATE INDEX index_bulk_update_requests_on_forum_post_id ON public.bulk_update_requests USING btree (forum_post_id);
--
-- Name: index_bulk_update_requests_on_tags; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_bulk_update_requests_on_tags ON public.bulk_update_requests USING gin (tags);
--
-- Name: index_comment_votes_on_comment_id; Type: INDEX; Schema: public; Owner: -
--
@@ -7384,6 +7392,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200325073456'),
('20200325074859'),
('20200403210353'),
('20200406054838');
('20200406054838'),
('20200427190519');