Commit Graph

21 Commits

Author SHA1 Message Date
Earlopain
fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00
Earlopain
79bada3392
[Search] Unify user lookup
There was lots of duplication between id/name searching, with a plethora
of different approaches. Now it's all in one place.
A few places that didn't have name/id search previously now do.
2023-08-04 20:46:59 +02:00
clragon
3a2987c84f
[Search] Allow ascending order for IDs 2023-07-07 14:55:30 +02:00
Earlopain
0523058a5c
[Posts] Add helper method for the PostQueryBuilder 2023-02-25 18:40:42 +01:00
Earlopain
a98483f61b
[Posts] Use the new tag_string index in the PostQueryBuilder
This is only used as a subselect, which means that there is no need to order.
The source metatag uses a non-existant function, remove it.
No need to check for deleted posts, it's desired to show deleted thumbnails
on the post flag index for example.
2023-02-25 18:40:41 +01:00
Kira
1b929f7190 Allow post unapproval 2019-07-19 18:05:43 -07:00
Kira
86adf1eea4 Add fix up post disapproval things after revert 2019-04-11 23:46:34 -04:00
Zwagoth
4a46874a50 Revert "Remove post disapproval"
This reverts commit c6df9a33e0.
2019-04-11 23:39:44 -04:00
Kira
c6df9a33e0 Remove post disapproval
This simplifies the approval system to be a single user with an
auditing table. The disapproval system was confusing and outright
post deletion replaces it on e6.

Slightly changes the rules of how post approvals work to remove
a few limits that are not reflected on e6.
2019-02-19 20:20:15 -08: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
0ac28634f4 Fix #3708: Post approvals sometimes displays multiple approvers for same post 2018-05-11 17:15:51 -05:00
evazion
7c1d5e25fb post approvals: add index page + search options (fix #3579). 2018-05-05 14:00:49 -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
3c45273694
Add category for mod actions 2018-01-13 20:55:52 -08:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion
93c9b622a1 post_approval.rb: log correct post id when approving deleted posts. 2017-05-02 00:01:21 -05:00
evazion
70a7f77a48 Post#approve!: signal errors with invalid object instead of exception. 2017-04-03 17:18:32 -05:00
evazion
db0bcf08b9 Post#approve!: move approving logic to post_approval.rb. 2017-04-03 17:18:31 -05:00
evazion
258fc37bfe Post#approve!: move validation to post_approval.rb 2017-04-03 17:18:31 -05:00
Albert Yi
4e48e80e1f stub in preview for bulk revert 2016-11-02 13:53:01 -07:00
Albert Yi
2dbb869188 keep track of post approvals to prevent approval cycles 2016-10-31 17:51:44 -07:00