Commit Graph

102 Commits

Author SHA1 Message Date
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
3c45273694 Add category for mod actions 2018-01-13 20:55:52 -08:00
BrokenEagle
b9964e97a7 Don't log comment update action on delete 2018-01-13 20:42:07 -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
Albert Yi
5da62eff8d Merge branch 'master' into fix-3278 2017-12-13 14:30:08 -08:00
evazion
feb3ec0750 Fix #3417: Deleting a user's comment credits the change to them. 2017-12-02 19:41:37 -06:00
evazion
5b89f56c2e Move PostgresExtensions to ApplicationRecord. 2017-11-26 13:57:51 -06:00
BrokenEagle
8445a0c7ad Differentiate visible/hidden comments for moderators 2017-11-11 20:45:01 -08: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
evazion
a3a9a78015 /comments.json: default to id_desc order instead undefined order. 2017-05-09 18:12:37 -05:00
Albert Yi
d7e83bef79 Merge pull request #3003 from evazion/feat-noter-any-metatag
Add noter:<any|none>, commenter:<any|none> metatags
2017-05-01 14:52:30 -07:00
r888888888
48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
evazion
25aaef5afe Add tests for noter:<any|none>, comm:<any|none> metatags. 2017-04-26 16:51:34 -05:00
evazion
869f1610fc comments: use server-side quote-stripping instead of reimplementing in js. 2017-04-24 21:15:47 -05:00
Albert Yi
fd7cddc909 Merge branch 'master' into fix-mention-dmails 2017-02-27 17:00:24 -08:00
r888888888
b332273378 fixes #2892: after_destroy callbacks should be fired upon comment deletion 2017-02-27 16:45:51 -08: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
1d25d1315a Fix comment search bugs (secondary ordering, non-bumping typo) 2017-01-27 14:12:16 +05:00
evazion
caaff24112 /comments?group_by=comment: add is_sticky/is_deleted/do_not_bump_post/order params. 2017-01-23 22:13:00 -06:00
Albert Yi
5445b341bc fixes #2822: Post vote API: returns 200 for both success and failure; fixes bug with x-api-limit header 2017-01-09 17:31:14 -08: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
2fef0cdef9 Merge pull request #2804 from evazion/feat-comment-as-mod
Add option to comment as moderator (fix #2799)
2016-12-27 11:49:36 -08:00
Albert Yi
0293d1d01c Update comment.rb
allow Comment#for_creator to handle null user id case
2016-12-27 11:32:41 -08:00
evazion
1257639109 Add 'post as moderator' option for comments.
* Add 'post as moderator' option to comment form. This creates a so-called sticky comment.
* Downvotes have no effect on stickied comments; they're always visible, regardless of comment thresholds.
* Only mods may sticky comments.
* Mods may sticky comments by other users.
2016-12-26 23:52:45 -06:00
evazion
1b05d5068a Simplify Comment.for_creator_name. 2016-12-26 23:52:27 -06:00
evazion
9347f27059 /comments.json: add id param; allow id and post_id to take lists of ids. 2016-12-26 23:52:27 -06:00
evazion
69c50290a8 Include updater_name in /comments/1.json. 2016-12-26 23:52:27 -06:00
Albert Yi
67c374f272 fix relative links in at mentions 2016-11-18 11:42:49 -08:00
evazion
cb1e1d3a94 Prevent commenting on nonexistent posts (#2704). 2016-10-06 09:39:57 +00:00
r888888888
8a63fb0f7c enable mention for comments #2466 2015-11-30 16:51:07 -08:00
Toks
4cc8f94970 Fix comment searches specifying both post_tags_match and is_deleted
fixes #2450
2015-07-23 19:55:24 -04:00
Toks
9f47a9da1b Add is_deleted comment search param 2015-07-23 09:58:55 -04:00
Toks
52c73efc28 Fix thumbnail appearing next to deleted comments 2015-07-23 09:57:13 -04:00
Toks
a4440514ff Allow undeleting comments 2015-07-11 13:26:55 -04: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
4f4fd8cb35 fixes #2428 2015-07-04 22:00:31 -04:00
r888888888
1d9596d7f2 fixes #2417 2015-06-29 18:17:59 -07:00
Toks
1b812f31f1 fixes #2226 2014-07-16 11:47:37 -04:00
Toks
772003a55a fixes #2217 2014-07-06 12:03:48 -04:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
Toks
8055a7c64b Fix order:comm and comment deletion for unbumped comments
fixes #1351, fixes #1352
2013-12-24 20:59:19 -05:00
Toks
ecfcebe30a Add support for wildcard searches in text fields
#1663
2013-07-20 16:51:55 -04:00
Toks
938e19f384 merge branch changeable-votes 2013-06-29 15:12:38 -04:00