Commit Graph

34 Commits

Author SHA1 Message Date
BrokenEagle
c4009efccd Convert models to use new search includes mechanism 2020-07-27 19:29:18 +00:00
BrokenEagle
e23ee170f5 Add alternate comparison types to versions
- The types are:
-- Previous: The default and the previously used type
-- Subsequent: Compares against the next version
-- Current: Compares against the current version
- Allow switching between comparison types in index and diff views
-- Have links vary depending upon current comparison type
2020-03-17 18:31:20 +00:00
BrokenEagle
63b3503bfc Add ability to use nested only parameter
- The only string works much the same as before with its comma separation
-- Nested includes are indicated with square brackets "[ ]"
-- The nested include is the value immediately preceding the square brackets
-- The only string is the comma separated string inside those brackets
- Default includes are split between format types when necessary
-- This prevents unnecessary includes from being added on page load
- Available includes are those items which are allowed to be accessible to the user
-- Some aren't because they are sensitive, such as the creator of a flag
-- Some aren't because the number of associated items is too large
- The amount of times the same model can be included to prevent recursions
-- One exception is the root model may include the same model once
--- e.g. the user model can include the inviter which is also the user model
-- Another exception is if the include is a has_many association
--- e.g. artist urls can include the artist, and then artist urls again
2020-02-12 23:58:53 +00:00
BrokenEagle
d8fd1c212e Revise display on note versions index
- Body now uses the diff builder to highlight changes
-- A generalized diff-body class was added instead of something specific
- The status changes are now verbalized instead of being shown with styles
- The position and sizes are now split up
-- Changes directly reference the previous version
- The date and user columns were combined
-- This is more in line with other indexes, plus it saves space
2020-02-08 22:57:27 +00:00
BrokenEagle
76dcccb7de Alter previous method on all versions models
This is to prevent redoing the same SQL query which wasn't being cached.
2020-02-08 16:14:51 +00:00
evazion
895199ecfc models: include all int/bool columns as html data attributes by default. 2020-01-05 22:57:47 -06:00
BrokenEagle
223a6df5d8 Add API data to show/index views 2020-01-04 22:02:44 +00:00
evazion
67100f26eb Fix #4149: Add missing post search options on applicable models. 2019-09-01 13:10:37 -05:00
evazion
7b8584e3b0 Model#search: refactor searching for attributes. 2019-08-29 20:44:33 -05:00
evazion
c3ad7f6112 Model#search: factor out username search. 2019-08-29 20:44:27 -05:00
evazion
9a3e9747d8 users: replace scopes with associations. 2019-08-29 20:42:50 -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
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -07:00
evazion
216d735f24 Fix #3696: API: handle boolean params consistently
* Use ApplicationRecord#attribute_matches to handle boolean attributes
  consistently in search methods.

* Add support for searching various boolean attributes that previously
  weren't supported.
2018-05-03 19:57:14 -05: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
ba7fadf6e9 Fix missing controllers for search[id] 2018-01-13 10:01:57 -08:00
evazion
fd9dc6f647 expunge: decrement upload and note/post update counts (fix #2062). 2017-09-13 13:29:35 -07:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
02b3622f12 api: allow search[*_id] params to accept lists of ids in more places. 2017-05-23 15:45:40 -05:00
Toks
0409d6fd69 Fix diff bug for note versions from Danbooru 1 2015-05-16 12:11:27 -04:00
Toks
ad8e16aabf fix #2012 2015-04-15 11:29:15 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
56dd8707fd controller tweaks 2013-02-23 15:58:21 -05:00
albert
72b7651169 improved search methods 2013-01-11 17:13:55 -05:00
albert
8749c43b3e refactored search 2013-01-10 17:45:52 -05:00
albert
80f34d08d9 revert default scope change 2013-01-07 17:24:03 -05:00
albert
040059c491 add default scopes to every model 2013-01-07 17:12:43 -05:00
albert
e42ea9c608 added popular exploration, added order:rank 2011-08-11 15:39:51 -04:00
albert
cbd877d020 fixed comment vote functional test 2011-04-01 19:01:17 -04:00
albert
683d4583ac * Added note version controller and test
* Added pool version controller and test
* Refactored unit tests for post disapprovals
* Renamed PostModerationDetail to PostDisapproval
2011-01-25 18:13:05 -05:00
albert
5610731b35 sync 2010-08-18 18:42:33 -04:00
albert
55700efeb1 added notes 2010-02-24 15:40:55 -05:00