Commit Graph

112 Commits

Author SHA1 Message Date
Albert Yi
caf60d690d better check for forum post votability 2019-01-28 17:23:33 -08: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
308cfc2376 reduce constraints for when to show forum post vote links (#3691) 2018-05-15 11:20:16 -07:00
Albert Yi
9310b39fda hide forum votes if the request is not pending 2018-05-11 17:05:26 -07: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
185d4ef81f split out tag_relationship has_one relationship on forum post to alias/impication (#3686) 2018-04-28 19:28:17 -07:00
r888888888
015aa5abfe fixes #3686 2018-04-28 17:42:39 -07:00
Albert Yi
d4b1782431 allow more forum posts to be voted on (fixes #3677) 2018-04-27 16:18:31 -07:00
Albert Yi
f2b525a6d2 Implement forum topic voting and tag change pruning (#3580) 2018-04-26 15:31:06 -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
3c45273694 Add category for mod actions 2018-01-13 20:55:52 -08:00
evazion
0ca726802f Fix #3430: Accept the search[id] param in all controllers.
* Allow every controller to take the `search[id]` param.

* Parse the `search[id]` param the same way that the `id:<N>` metatag is
  parsed. So `search[id]=1,2,3`, `search[id]=<42`, `search[id]=1..10`, for
  example, are all accepted.
2017-12-17 17:36:52 -06:00
r888888888
3ad332ad3d fix post test 2017-11-16 14:20:32 -08:00
evazion
b5d602836c Don't send @mention dmails when updating forum after approving BURs. 2017-11-15 19:12:13 -06:00
evazion
4c54e18c6d mentions: factor out mention parsing to DText.parse_mentions. 2017-08-04 23:48:31 -05:00
evazion
c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
evazion
869f1610fc comments: use server-side quote-stripping instead of reimplementing in js. 2017-04-24 21:15:47 -05:00
evazion
46280f2227 mentions: include mentioner in subject line.
The template looks like this:

Subject:

    #{creator_name} mentioned you in a comment on post ##{post_id}

Body:

    @#{creator_name} mentioned you in a \"comment\":/posts/#{post_id}#comment-#{id} on post ##{post_id}:

    [quote]
    #{DText.excerpt(body, "@"+user_name)}
    [/quote]
2017-02-25 23:05:44 -06:00
Type-kun
922276da6b Fixed typo in forum post mod action 2017-01-14 15:52:43 +05:00
Albert Yi
f2a5d45db0 implement token bucket rate limiting 2017-01-09 17:31:14 -08:00
Type-kun
9da5e67a65 Another partial fix for issue #2824, which also affected ip bans and feedback
Also fixed minor errors with IP bans
2017-01-09 13:57:16 +05:00
Type-kun
c44c40c759 Partial fix for issue #2824 2017-01-08 23:58:52 +05:00
Albert Yi
b9a1e115fb add additional mod actions 2017-01-03 16:02:36 -08:00
Albert Yi
536ba3c7ee fixes #2756: Have @Mentions Use Relative Instead of Absolute Links 2016-11-14 10:15:11 -08:00
Albert Yi
eb6746a8a8 additional checks on forum topic visibility 2016-11-07 10:48:04 -08:00
evazion
f46d055218 Fix AmbiguousColumn exception in /forum_posts?search[creator_id]=1 2016-10-31 17:11:52 -05:00
evazion
5d54ba5096 Fix listing private topics in /forum_posts.
Fix an exploit allowing viewing of private topics with

  http://danbooru.donmai.us/forum_posts
2016-10-30 18:00:26 -05:00
Albert Yi
60eebd9608 fix chaining of hidden_attributes/method_attributes 2016-10-27 14:53:25 -07:00
Albert Yi
79842f7a3b restrict min level constraints for forum topics to mod+admin and restrict options based on current user's level. check privileges for visiblity in forum posts and topics. deprecate serializable_hash (undocumented, internal) for as_json, refactor to use hidden_attributes and method_attributes #2658 2016-10-25 15:05:55 -07:00
r888888888
8a63fb0f7c enable mention for comments #2466 2015-11-30 16:51:07 -08:00
r888888888
cae88fdac2 fixes #2537: Mention dmail contains <hr> 2015-10-26 12:52:53 -07:00
Toks
44d2437d33 Fix broken link in mention dmail 2015-10-23 16:46:25 -04:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07:00
r888888888
821c7bc2a5 add dmail notices for mentions in forum posts 2015-10-14 15:32:48 -07:00
r888888888
e675016ec5 fixes #1904: Display aliases/implications in artist excerpt, fixes bug with approving alias/implications involving artists 2015-08-06 16:40:30 -07:00
Toks
0691477a3b Fix forum deletions 2015-07-15 00:40:58 -04:00
r888888888
6ad6aa44c4 fixes #2432, fix tests 2015-07-14 15:13:04 -07:00
Toks
fe7f3d8204 Keep track of who deletes forum post/topic/comment
Previously it would look like the creator of it was the one who
deleted/undeleted it, even if it was someone else.
2015-07-11 13:20:47 -04:00
Toks
b3a665d096 #2417 remove janitor from mod-only attr_accessible 2015-06-30 12:59:39 -04:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
Toks
7c2ce325a3 fix #2403, remove unused code 2015-06-08 17:34:13 -04:00
Toks
30700df635 Fix deleted forum posts not counting in response_count 2014-11-12 00:41:55 -05:00
r888888888
74e1355728 fix tests 2014-09-30 17:24:54 -07:00
Toks
13101e7c88 #2250 fix validations not allowing empty topic id 2014-08-23 20:01:56 -04:00
Toks
c5cabe4e58 fix for #2250 2014-08-23 19:41:44 -04:00
Toks
2300e9bd1e fixes #2244 2014-08-17 12:07:53 -04:00
r888888888
2b96040a30 fixes #2191 2014-08-12 17:03:16 -07:00