Commit Graph

24 Commits

Author SHA1 Message Date
evazion
b4ce2d83a6 models: remove belongs_to_creator macro.
The belongs_to_creator macro was used to initialize the creator_id field
to the CurrentUser. This made tests complicated because it meant you had
to create and set the current user every time you wanted to create an
object, when lead to the current user being set over and over again. It
also meant you had to constantly be aware of what the CurrentUser was in
many different contexts, which was often confusing. Setting creators
explicitly simplifies everything greatly.
2020-01-21 00:09:38 -06:00
evazion
eecd9a183d comments: add test for undeleting locked comments.
ref: #4258, #2728.
2020-01-17 00:18:29 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
fc3441606e forum posts, comments: make timestamps into permalinks.
Make the timestamp beneath the username on forum posts into a permalink
that links to the post in full context of the thread. For comments, make
the timestamp link to the comment in full context of the post.

* Make the timestamp in forum posts link to /forum_posts/123.
* Make the timestamp in comments link to /posts/456#comment_123.
* Make /forum_posts/123 redirect to /forum_topics/456#forum_post_123.
* Make /comments/123 redirect to /posts/456#comment_123.
* Remove the "ID: ###" and "Permalink" fields from forum posts.
2019-09-29 15:57:15 -05:00
evazion
c85bbbf8c2 comments: fixup "show hidden comments" link.
Fixup for 896f144eb.
2019-09-17 00:28:40 -05:00
evazion
ee77b101af comments: change 'Show all comments' to 'Show N hidden comments'. 2019-08-31 16:32:15 -05:00
evazion
be36968b6d Fix #3351: Mod+: Treat deleted comments as below score threshold.
Comments have three states: visible, hidden, and invisible. Visible
comments are always shown. Hidden comments are not shown until the user
clicks 'Show all comments'. Invisible comments are never shown to the
user. Deleted comments are treated as hidden for moderators and
invisible for normal users. Thresholded comments are treated as hidden
for all users.
2019-08-31 16:24:44 -05:00
evazion
d4c43af1dd app controller: replace calls to access_denied with PrivilegeError.
Standardize controllers to raise User::PrivilegeError instead of calling
`access_denied` directly.
2019-08-24 23:10:22 -05:00
evazion
7c1552061b tests: fix authentication in controller tests.
Fix controller tests to login for real instead of faking it.
2019-08-24 22:55:35 -05:00
evazion
151fa00933 tests: fix tests for /comments/new, /post_flags/new. 2018-10-01 10:38:15 -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
e68946e95d /comments.atom: add atom feed for comments. 2017-05-13 10:37:58 -05:00
evazion
0890c6320b tests: add more comments controller tests. 2017-02-06 18:48:38 -06:00
evazion
0e73f3c8a9 Add tests for stickying comments. 2016-12-26 23:52:46 -06:00
evazion
cb1e1d3a94 Prevent commenting on nonexistent posts (#2704). 2016-10-06 09:39:57 +00:00
evazion
8c8f4a6a8f Fix mass assignment vuln in comment update action (#2704).
Prevents mass assignment of `post_id`, `do_not_bump_post`, and
`is_deleted`.
2016-10-06 09:39:57 +00:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
3463e45675 fix tests 2011-12-14 11:28:05 -05:00
albert
cbd877d020 fixed comment vote functional test 2011-04-01 19:01:17 -04:00
albert
541163685d implemented forum post controller 2011-01-13 18:16:39 -05:00
albert
46164eab4f finished dmails and favorites functional tests 2010-12-05 22:27:45 -05:00
albert
976a25a6c6 additional functional tests, some controller fixes 2010-12-01 18:50:04 -05:00
albert
ac98d7db37 stubbed in blank controllers/helpers/functional tests 2010-03-10 18:21:43 -05:00