Commit Graph

36 Commits

Author SHA1 Message Date
evazion
03abbd0683 Fix #2894: Use [[:space:]] instead of \s in regexes. 2018-09-20 19:24:38 -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
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
evazion
feb3ec0750 Fix #3417: Deleting a user's comment credits the change to them. 2017-12-02 19:41:37 -06:00
evazion
69d4712708 mentions: process mentions added in an edit (fix #2736) 2017-08-04 23:48:53 -05:00
evazion
a3a9a78015 /comments.json: default to id_desc order instead undefined order. 2017-05-09 18:12:37 -05:00
evazion
54db229094 comment_test.rb: add quote-stripping test. 2017-04-24 21:15:47 -05:00
evazion
c0e5c400a7 tests: fix tests for Rails.cache. 2017-04-16 16:48:36 -05:00
r888888888
0b8d4105aa fix tests 2017-04-04 12:39:17 -07: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
evazion
72502dbe2f Fix comment voting tests.
2) Error:
CommentTest#test_: A comment created by an unlimited user should not allow duplicate votes. :
ActiveRecord::RecordInvalid: Validation failed: You have already voted for this comment
    app/models/comment.rb:142:in `vote!'
    test/unit/comment_test.rb:164:in `block (3 levels) in <class:CommentTest>'

  3) Error:
CommentTest#test_: A comment created by an unlimited user should not allow upvotes by the creator. :
ActiveRecord::RecordInvalid: Validation failed: You cannot upvote your own comments
    app/models/comment.rb:142:in `vote!'
    test/unit/comment_test.rb:179:in `block (3 levels) in <class:CommentTest>'
2017-02-03 04:03:44 -06:00
Albert Yi
b9a1e115fb add additional mod actions 2017-01-03 16:02:36 -08:00
evazion
0e73f3c8a9 Add tests for stickying comments. 2016-12-26 23:52:46 -06:00
evazion
01afc46f74 Fix failures in commenting tests.
Restricting users from upvoting their own comments broke some tests.
Switch these tests to downvoting instead.
2016-12-03 20:06:50 -06:00
evazion
1047d7c96b Prevent users from upvoting their own comments. 2016-11-06 01:32:54 -06: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
8055a7c64b Fix order:comm and comment deletion for unbumped comments
fixes #1351, fixes #1352
2013-12-24 20:59:19 -05:00
Toks
8c7fa25a5d add tests for #1263 2013-06-29 15:10:09 -04:00
r888888888
4dff618863 Use webmock instead of fakeweb for VCR; Fix tests; Use Timecop to speed up tests previously using sleep; Move artist rename into seperate operation 2013-05-24 12:59:13 -07:00
albert
b19994396d fix tests, fixes #1173 2013-04-03 17:23:25 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
922ccabe1d fix comment votes affecting comment updater_id 2013-03-18 16:03:29 -07:00
albert
1da9e24bd0 fixes #804 2013-03-09 01:56:59 -05:00
albert
4cbef26c05 fix comment bumping 2013-02-24 17:54:42 -05:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
4d4ae4b443 tests 2012-05-11 18:26:14 -04:00
albert
91ef2a6df2 improved test 2012-05-11 18:04:50 -04:00
albert
8fffa9747f fix attr_accessible 2011-12-14 11:19:58 -05:00
albert
f587724476 fixes #101: comment limitations 2011-10-03 18:54:01 -04:00
albert
22074eed1f fixes #69: Comment voting non functional 2011-09-14 17:46:42 -04:00
Dean Matzkov
5efb6a5b92 Fix unit tests for ruby-1.8 compatibility 2011-09-08 21:00:29 -06:00
albert
aee5cf0aa1 fixed unit tests 2011-03-30 15:11:22 -04:00
albert
ad39553aac updated tests, switched to rails 3.0.0rc2 2010-08-26 14:36:02 -04:00
albert
9f353c32f4 added post voting 2010-02-15 17:45:09 -05:00
albert
e9c2d1e636 added artists, comments 2010-02-15 13:59:58 -05:00