Commit Graph

47 Commits

Author SHA1 Message Date
evazion
71a3cc89fd BURs: don't try to move wikis/artists twice.
* Remove unnecessary rename_aliased_pages option. This option was always enabled.
* Don't try to rename the artist and wiki page inside AliasAndImplicationImporter
  when an alias is approved. This is already handled by TagAlias#process!.
2020-05-10 21:22:22 -05:00
evazion
5feb29ba57 Fix #4441: BUR form: display original request in the error page. 2020-05-04 03:39:41 -05:00
evazion
d5a7fafca1 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.
2020-04-27 19:11:47 -05:00
evazion
3dab648d0e search: refactor PostQueryBuilder class methods into instance methods.
* Make scan_query, parse_query, normalize_query into instance methods
  instead of class methods. This is to a) clean up the API and b)
  prepare for moving certain tag utility methods into PostQueryBuilder.

* Fix a few cases where a caller used scan_query when they should have
  used split_query or parse_tag_edit.
2020-04-22 19:38:17 -05:00
evazion
7726563733 search: refactor scan_query callers to use split_query.
Refactor to use split_query instead of scan_query to split a query on
spaces. Preparation for refactoring scan_query into something smarter.
2020-04-19 02:54:44 -05:00
evazion
0e7632ed8a aliases/implications: remove forum topic updating code.
Remove code for updating forum topics when an alias or implication is
approved or rejected. This code was only used when approving single
alias or implication requests. This is no longer used now that all
alias/implication requests are done through BURs.
2020-03-10 20:55:20 -05:00
evazion
967d398c8e search: move query parsing code from tag model to post query builder. 2020-03-06 23:23:38 -06:00
evazion
5817af4014 burs/show: remove BUR update count estimate.
Remove the post update count estimate from BUR show pages. This was
complex, slow, and usually inaccurate since it assumed that requests in
a BUR had no overlap with each other, which usually wasn't the case.
2020-02-16 19:21:56 -06:00
evazion
b4ce2d83a6 models: remove belongs_to_creator macro.
The belongs_to_creator macro was used to initialize the creator_id field
to the CurrentUser. This made tests complicated because it meant you had
to create and set the current user every time you wanted to create an
object, when lead to the current user being set over and over again. It
also meant you had to constantly be aware of what the CurrentUser was in
many different contexts, which was often confusing. Setting creators
explicitly simplifies everything greatly.
2020-01-21 00:09:38 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
2e6486ab5f BURs: fix exception in category change requests for new tags.
`category blah -> character` failed when `blah` didn't exist yet.
2019-12-10 15:17:10 -06:00
evazion
6196f7ba67 BURs: fix exception when estimating post counts of category changes.
Fix an error in operator precedence:

> sum + Tag.find_by_name(token[1]).try(:post_count) || 0

This was treated as `(sum + X) || 0` not `sum + (X || 0)` as intended.
This failed when X was nil.
2019-12-10 01:43:05 -06:00
evazion
2bffad9311 BURs: credit tag edits to DanbooruBot.
Credit tag edits that are performed as part of an alias, implication, or
mass update to DanbooruBot instead of the admin who approved the BUR.
2019-12-06 22:54:08 -06:00
evazion
dab43d96c9 jobs: migrate mass updates to ActiveJob.
Also fixes a bug where mod actions weren't logged on mass updates.
Creating the mod action silently failed because it was called when
CurrentUser wasn' set.
2019-08-19 00:46:31 -05:00
Albert Yi
1550538dc1 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.
2019-01-22 17:22:07 -08:00
Albert Yi
f33b23d035 add post count estimates for bulk update requests 2019-01-09 15:54:55 -08:00
evazion
886096b47a BURs: fix remove alias command removing inactive aliases.
Fix the `remove alias` and `remove implication` commands to only remove
active aliases or implications, not pending/deleted/retired ones.
2019-01-03 16:30:39 -06:00
evazion
d393d67a9b aliases/implications: don't destroy removed aliases (#4024). 2018-12-31 17:07:14 -06:00
evazion
f5c9616f62 tests: fix broken tests. 2018-09-24 17:34:08 -05:00
evazion
03abbd0683 Fix #2894: Use [[:space:]] instead of \s in regexes. 2018-09-20 19:24:38 -05:00
evazion
2b8767d7f4 BulkUpdateRequest#approve!: don't swallow exceptions.
Rescue `AliasAndImplicationImporter::Error` instead of `Exception`.
2018-02-24 14:37:02 -06:00
evazion
19bda2056c tags: update category cache whenever category changes.
Do `update_category_cache_for_all` in a callback instead of calling it
manually everywhere.
2017-12-23 13:07:23 -06:00
r888888888
2e0534a66b fixes #3372 2017-11-16 12:00:54 -08:00
r888888888
19b8d41d09 refactor forum notifications for tag changes 2017-04-12 16:43:15 -07:00
evazion
c2e026e55b Fix BURs posting approval message for every implication. 2016-11-02 16:12:53 -05:00
evazion
6dd8ec909d Set approver of aliases/implications in BURs.
Previously only the BUR's approver was set when a BUR was approved. Set
the approver for each alias/implication in the BUR as well.

Additionally:

* Refactor `approve!` to take a user instead of just a user id.
* Be mass-assignment permissions aware when setting approver_id.
2016-10-26 21:52:19 -05:00
r888888888
3e3f90d79a fix bug with alias/implication processing 2016-06-15 13:11:49 -07:00
r888888888
667f912093 fixes #2590: Approving implication creates forum post under "albert" instead of actual approver 2016-04-25 16:48:53 -07:00
r888888888
d75546a4e4 add secondary validations to aliases+implications+requests 2016-02-11 11:48:56 -08:00
r888888888
e6b16e8fe5 better validation for bulk update requests 2016-01-28 17:59:45 -08:00
r888888888
8b054a6922 fixes #1517: Add synonym support to batch alias/implication form 2015-07-29 18:00:41 -07:00
r888888888
6ff02c653d dmail bulk update request errors to admin 2015-04-21 18:39:42 -07:00
Toks
ece0ef844f fix #2364 2015-04-05 19:00:51 -04:00
Toks
99346ceb54 Better error when alias/implication fails validation
Before it would just say "Jobs cannot be created for non-persisted
records" instead of the real error
2015-04-05 18:55:38 -04:00
r888888888
dae7c615e9 fixes #2206 2014-06-24 11:07:39 -07:00
Toks
3103b97c8b fixes #2198 2014-06-17 13:19:40 -04:00
Toks
15d4c90688 Fix bug where importing mass updates would not work 2014-06-17 02:34:54 -04:00
r888888888
075f11e71d fixes #2185 2014-06-12 21:45:17 -07:00
r888888888
e64dac0b5d more lenient regexp for #2185 2014-06-11 16:56:45 -07:00
r888888888
554007ce91 fixes #2185 2014-06-11 16:53:24 -07:00
r888888888
19d886af01 fixes #1973 2013-09-12 15:14:29 -07:00
Toks
0f5fe4e7b6 fixes #1234 2013-05-02 22:25:44 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
89c0ab86a8 add default queue 2013-03-03 01:21:00 -05:00
albert
f5405c8c67 compatibility for postgres 8.4 2012-08-30 14:45:01 -04:00
albert
67448d4636 automatically identify ad type 2011-12-21 18:41:17 -05:00
albert
bae1f39dcf added alias and implication importer 2011-12-20 11:46:07 -05:00