Commit Graph

135 Commits

Author SHA1 Message Date
evazion
8756480500 search: drop special case for pixiv urls in source: metatag.
* Drop support for `source:pixiv/artist-name` searches. This was a hack
  that only worked on old pixiv urls that haven't been used for years.
* Replace the old SourcePattern(lower(source)) index with a trigram index.
2019-08-29 02:06:35 -05:00
evazion
4f024d2360 pools/show: fix N+1 query on pool show page.
Fix a N+1 query when fetching posts to render thumbnails. Also adds
support for the `limit` url param on the posts show page.
2019-08-09 00:05:50 -05:00
evazion
4a1f0523a4 search: add comment_count, note_count metatags (#4004).
Add these metatags:

* comment_count
* deleted_comment_count
* active_comment_count
* note_count
* deleted_note_count
* active_note_count
* order:comment_count
* order:deleted_comment_count
* order:active_comment_count
* order:note_count
* order:deleted_note_count
* order:active_note_count
2018-12-11 18:10:20 -06:00
evazion
37b2214472 post_tags_match: replace joins with subqueries.
Refactor various post_tag_match methods to use subqueries instead of joins.

This simplifies things inside PostQueryBuilder, since now we can assume
we're always dealing with a Post relation, rather than some other table
joined with the posts table.
2018-12-11 18:10:20 -06:00
evazion
d82418ed43 Fix #3988: ordpool:<name> fails for large pools.
Also fixes ordpool:<name> not returning all posts in the correct order
when searching for series pools that contain duplicate posts.
2018-11-16 22:48:17 -06:00
Albert Yi
0508b127fd continue refactoring savedsearch 2018-11-15 12:06:13 -08:00
evazion
115ed16a96 pools: store post_ids as array instead of string (fix #3979) 2018-11-08 15:09:31 -06: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
083c537abf Fix #3769: Favgroup search negation doesn't work as expected. 2018-08-22 17:33:23 -05:00
evazion
9a0f37e359 Fix #3715: Provide any/none modifiers for pixiv: metatag 2018-08-22 00:25:38 -05:00
Albert Yi
79ea6f7e6c Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
2018-05-09 09:56:38 -07:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
BrokenEagle
d829ab3a00 Move all order logic to models
- Have a default order for each model
-- The overall default is ID DESC
- Allow for custom orderings
-- When comma-separated IDs are used
2018-01-29 11:42:53 -08:00
BrokenEagle
7c9dd80d35 Fix status:active so that it doesn't show flagged posts 2017-12-28 12:17:11 -08:00
BrokenEagle
26c168bdcd Fixed incorrect showing of favorites
- Moved all favorite checking logic to same file
2017-12-18 12:17:17 -08:00
Albert Yi
0674a03fb6 Merge pull request #3353 from BrokenEagle/feat-add-meta-tag-category
Migrated tag logic into config file and added fifth tag category meta
2017-11-13 11:44:15 -08:00
BrokenEagle
5b4ab8d80e Disallow a user from seeing flagger's name on own uploads 2017-11-08 00:37:16 -08:00
BrokenEagle
6838901aac Moved non-config tag category info to its own class 2017-11-07 16:21:29 -08:00
BrokenEagle
1e5540f3a0 Moved most of the tag category config logic to the config file
-Fixed an unused Post class method (fix_post_counts) that didn't have a parameter
2017-11-06 15:27:54 -08:00
evazion
7b96d9dcd4 Fix 'Deleted post filter' option applying to status:{any,all} (#3245).
https://danbooru.donmai.us/forum_topics/9127?page=196#forum_post_134342
2017-08-04 17:15:39 -05:00
Albert Yi
e4bc01533b Merge pull request #3245 from evazion/fix-2344
Fix #2344: Negating status metatag breaks deleted post filter.
2017-07-31 12:50:21 -07:00
evazion
1c38fbbf64 Fix #2344: Negating status metatag breaks deleted post filter. 2017-07-28 19:52:35 -05:00
evazion
fffc107d4f Add order:{tagcount,gentags,arttags,chartags,copytags} metatags. 2017-07-21 23:11:02 -05:00
evazion
df33901938 PostQueryBuilder: remove unused has_constraints attr (#3206).
This was previously used to prevent searches that contained only negated
tags. No longer used.
2017-07-07 16:08:02 -05:00
r888888888
361e98edee fix for flagger_id_neg search case where nothing is matched 2017-06-29 13:03:36 -07:00
Type-kun
bf6add5273 Add more support for negated existing metatags 2017-06-15 18:11:53 +05:00
Type-kun
1375cc5307 Added privilege check for seeing flagger usernames
Also reworked all places dealing with flagger names to use said privilege
2017-06-14 20:43:25 +05:00
Type-kun
5d4592e0e0 Add "flagger:" and "appealer:" metatags (fixes #3142) 2017-06-13 00:15:49 +05:00
evazion
8f98e8e03c posts: redefine source column to be non-NULL (fixes #3090). 2017-05-26 13:54:17 -05:00
evazion
05c6716def Fix date:, age: metatags to use the index. (fix #672). 2017-05-23 12:59:08 -05:00
evazion
fad4d48b1c search: fix order:note, order:comment_bumped to use indexes. 2017-05-19 18:19:05 -05:00
evazion
d74eda2b96 search: readd posts.id secondary sort to order: metatags. 2017-05-19 18:19:04 -05:00
evazion
b0626a9124 Add commenter:<any|none> metatags. 2017-04-26 16:51:34 -05:00
evazion
69d9cf3927 Add noter:<any|none> metatags. 2017-04-26 16:51:34 -05:00
r888888888
6842056d19 partial fix for #3000 2017-04-26 13:37:12 -07:00
r888888888
97da8f8647 deprecate tag subscriptions with warnings 2017-04-14 16:00:20 -07:00
evazion
558e4e5443 Add filetype: metatag. 2017-02-02 00:53:56 -06:00
Type-kun
8848fa2e2f Fixes #2861 2017-01-27 20:08:43 +05:00
evazion
601b439f96 Add order:comment_bumped, order:comment_bumped_asc metatags. 2017-01-21 11:10:40 +00:00
Albert Yi
62956be384 hide saved search functionality if not enabled 2016-12-21 14:53:39 -08:00
Type-kun
6241a50c31 Fix #2628 along with similar bug for notes 2016-09-19 17:51:36 +05:00
r888888888
20cd6076a1 fixes #2660: Support approver:any and approver:none metatags 2016-09-09 14:30:35 -07:00
r888888888
c10176e64d add upvote and downvote metatags 2016-09-08 17:48:50 -07:00
r888888888
278fe3ca20 increase decay rate for order:rank 2016-03-05 17:20:52 -08:00
r888888888
caf4a28b02 enable user privacy mode for displaying favorites 2016-02-22 12:18:19 -08:00
r888888888
89794a7ef2 add saved search gallery link, can only view your own saved searches, normalize saved search categories 2015-11-24 16:41:03 -08:00
r888888888
21ab11d92a add support for saved search metatag + tests 2015-11-24 12:55:18 -08:00
Toks
5bc0eea161 Allow searching by negated favgroup: metatag 2015-08-07 16:54:22 -04:00
Toks
d811aa0b8a Fix error when favgroup doesn't exist 2015-06-29 15:15:17 -04:00