Commit Graph
2334 Commits
Author SHA1 Message Date
evazion 29cdaddd86 PostSetPresenters::Post#related_posts: clean up metatag parsing (#2894).
* Fix `#related_tags` to use `Tag.has_metatag?`.
* Fix Tag::SUBQUERY_METATAGS and Tag::METATAGS to be arrays instead of regexes.
2018-09-20 19:23:47 -05:00
evazion 6fe883c316 posts index: clean up limit:<n> / order:random parsing (#2894)
* Move the limit:<n> / order:random metatag parsing from the controller
  to the post set.

* Introduce `Tag.has_metatag?` and use it to parse these metatags
  instead of using a regex (#2894).
2018-09-20 19:23:47 -05:00
Albert Yi 9e1e73ec4c migrate blacklists during mass updates (#2251) 2018-09-19 16:25:06 -07:00
Albert Yi ed5b2ad443 throw error on counts/posts endpoint during a timeout (#2170) 2018-09-19 13:34:50 -07:00
Albert Yi 1a1d74d1ca add diff link on wiki page versions (#1622) 2018-09-17 17:36:46 -07:00
evazion 3afc0b3a78 artist urls: add more url search params for /artist_urls.
Adds these search params:

* /artist_urls?search[url]=...
* /artist_urls?search[url_eq]=...
* /artist_urls?search[url_not_eq]=...
* /artist_urls?search[url_like]=...
* /artist_urls?search[url_ilike]=...
* /artist_urls?search[url_not_like]=...
* /artist_urls?search[url_not_ilike]=...
* /artist_urls?search[url_regex]=...
* /artist_urls?search[url_not_regex]=...

and likewise for normalized_url.
2018-09-15 19:58:54 -05:00
evazion c06af060f9 artist urls: add artist, url_matches search params to /artist_urls. 2018-09-15 19:58:31 -05:00
evazion 1fce794b99 artist urls: add /artist_urls index page. 2018-09-15 19:58:05 -05:00
evazion 761f2649af artists: add more invalid name tests (#3901). 2018-09-14 13:32:45 -05:00
evazion 583f8457f0 artists: clean up artist finding logic.
Rename Artist#find_all_by_url to url_matches and drop previous
url_matches method, along with find_artists and search_for_profile.

Previously find_artists tried to lookup the url, referer url, and profile
url in turn until an artist match was found. This was wasteful, because
the source strategy already knows which url to lookup (usually the profile
url). If that url doesn't find a match, then the artist doesn't exist.
2018-09-11 20:14:46 -05:00
Albert Yi e3bbc92b88 change feedback category 2018-09-11 14:36:48 -07:00
Albert Yi 42f7b17a30 Merge pull request #3883 from evazion/refactor-anonymous-user
Refactor AnonymousUser
2018-09-11 12:09:25 -07:00
evazion a0ebd90409 Post#normalized_source: add hitomi.la url normalization. 2018-09-10 20:22:10 -05:00
evazion de10ea66a1 <role>_only: fix role checking logic to check ip bans last.
Make <role>_only methods check the role first and ip bans last. This
avoids hitting the database for anonymous users, since they'll always
fail the is_<role>? check before the ip check.
2018-09-09 21:53:24 -05:00
evazion e546e52bd7 Replace AnonymousUser with User.new.
* Replace AnonymousUser null object with a readonly, unpersisted User object.

* Default always_resize_images to true (previously it was true for
  anonymous users, but false for new members).

* Default comment_threshold to -1 for anonymous users (previously it was
  0 for anonymous but -1 for new members).
2018-09-09 21:53:08 -05:00
evazion 99a5e885e0 artist_url.rb: remove legacy artist url normalization code.
* `legacy_normalize` came from c6012535, which is no longer a problem.

* `normalize_for_search` is only used for "[mass edit]" links
in artist entries. These links are a shortcut for performing a
`-artist_name source:<artist_url> -> artist_name` mass edit to tag
untagged artists, but this won't work for most sites these days.
2018-09-07 12:55:51 -05:00
evazion 8e7dd9e97f artist_url.rb: remove unnecessary deviantart profile url normalization.
This is now handled in the source strategy.
2018-09-07 12:26:50 -05:00
evazion 06cf32160b user.rb: memoize upload limit methods.
These methods get called multiple times when rendering UserPresenter#upload_limit
on the upload page. This caused repeated COUNT(*) queries.
2018-09-06 20:31:51 -05:00
evazion aee1906761 Fix #3738: Artist URL search should be case-insensitive for domains. 2018-09-05 19:14:24 -05:00
Albert Yi 4b9f3e384f include more messaging for user feedback 2018-09-05 16:32:18 -07:00
Albert Yi 22e30186b1 add min bound for post count fixing 2018-09-05 14:08:05 -07:00
Albert Yi e5010bebf9 allow reportbooru to update post counts 2018-09-05 14:04:46 -07:00
Albert Yi 69b7c9efd0 Merge pull request #3838 from evazion/fix-3837
Fix #3837: Remove expired bans.
2018-09-05 12:03:46 -07:00
Albert Yi 8ec96f42f7 fix specs 2018-09-04 13:38:09 -07:00
Albert Yi 0529ec9ad0 Merge pull request #3862 from evazion/fix-3857
Refactor searching text attributes
2018-09-04 13:25:40 -07:00
evazion 6fc2d17886 Post#normalized_source: normalize da urls to new format (#3771) 2018-09-02 11:19:15 -05:00
evazion 0eff095a3e Refactor searching text attributes.
* Allow using ApplicationRecord#attribute_matches to search text attributes,
and standardize models on using this instead of duplicating code.

* Remove restrictions that limited wildcard searches to Builders only in various places.
2018-08-31 19:50:46 -05:00
Albert Yi 512629b1d5 Merge pull request #3847 from r888888888/intelligent-autocomplete
Intelligent autocomplete
2018-08-29 11:15:39 -07:00
Albert Yi 66e413b540 Adds fuzzy string matching and prefix matching 2018-08-28 16:41:52 -07:00
evazion 4f5cb0ba70 Post#has_artist_tag: fix "artist tag is required" triggering incorrectly.
Fixes the "Artist tag is required" upload warning to only trigger when
the source is from a first-party site.
2018-08-28 18:14:21 -05:00
Albert Yi 452413a80e eliminate monthly janitor trial messages 2018-08-28 14:58:00 -07:00
Albert Yi 68c30961ac Merge pull request #3805 from r888888888/refactor-sources
Refactor sources
2018-08-28 12:13:15 -07:00
evazion 6ff70c5002 mod actions: separate account upgrades from promotions (fix #3841) 2018-08-26 11:12:04 -05:00
evazion 3dafca9aec Fix #3842: Mods can demote other mods or admins. 2018-08-25 13:52:50 -05:00
evazion 0bb787d987 Post.pending_or_flagged: fix ambiguous column reference.
Fixes an ambiguous column reference error when searching for
`status:unmoderated` on the comments page:

    https://danbooru.donmai.us/comments?group_by=comment&search[post_tags_match]=status:unmoderated

Also removes the `id in (...)` subquery checking whether flagged posts
have a flag from the last week; this is always true.
2018-08-25 11:26:00 -05:00
evazion e33d6f9e84 Post#is_approvable?: fix 'Approve' link appearing on approver's own uploads.
Fixes the 'Approve' link in the modqueue and in the quickmod bar being
shown as available on the approver's own flagged uploads, even though
they can't actually approve these posts.
2018-08-25 11:12:37 -05:00
evazion 2cdd022c37 Fix #3837: Remove expired bans. 2018-08-24 16:49:34 -05:00
Albert Yi 762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
Albert Yi d8a6cee244 Merge pull request #3832 from evazion/feat-modqueue-metatags
Add status:<unmoderated|modqueue>, disapproval:<type> metatags
2018-08-23 13:53:33 -07:00
evazion 83cca4a382 PostDisapproval: fix duplicate initialize_attributes definition. 2018-08-23 15:24:57 -05:00
evazion 85ae2cda0d optimization: prefer relation.none over relation.where("false")
Using `relation.none` instead of `relation.where("false")` avoids an sql query.
2018-08-23 15:21:51 -05:00
evazion 4f02c7f70a search: add status:modqueue, status:unmoderated metatags.
* status:modqueue = ~status:pending ~status:flagged
* status:unmoderated = status:modqueue -user:self -approver:self -disapproval:any
2018-08-23 14:48:39 -05:00
evazion 89c4fe150a search: add disapproval:<any|none|disinterest|poor_quality|breaks_rules> metatag. 2018-08-23 14:08:02 -05:00
evazion 9a0f37e359 Fix #3715: Provide any/none modifiers for pixiv: metatag 2018-08-22 00:25:38 -05:00
evazion 8cc393183e Fix #3754: Include unbans in Mod Actions. 2018-08-22 00:08:33 -05:00
evazion 03a97d2962 Post#normalized_source: add toranoana.jp normalization. 2018-08-21 00:07:58 -05:00
evazion 33506839c4 Post#normalized_source: fix gelbooru source normalization.
Didn't handle https or md5-based subdirs:

    https://gelbooru.com//images/57/a3/57a3676a63e5cf4ab05463a3a9a953bb.jpg
        ^                        ^^^^^
2018-08-20 15:02:08 -05:00
evazion c504ad555d Fix #3822: Move favorites (while deleting) fails if user has also favorited destination 2018-08-19 00:54:17 -05:00
evazion 3419193341 Post#normalized_source: fix twipple.jp normalization. 2018-08-19 00:33:31 -05:00
evazion 03cf4c917e Post#normalized_source: prefer https links where supported. 2018-08-19 00:31:07 -05:00