Commit Graph

44 Commits

Author SHA1 Message Date
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
3f7e05316d api: refactor default options for xml responses.
In xml responses, if the result is an empty array we want the response
to look like this:

   <posts type="array"/>

not like this (the default):

   <nil-classes type="array"/>

This refactors controllers so that this is done automatically instead of
having to manually call `@things.to_xml(root: "things")` everywhere. We
do this by overriding the behavior of `respond_with` in `ApplicationResponder`
to set the `root` option by default in xml responses.
2019-09-08 15:32:31 -05:00
evazion
32343303d2 forum posts: raise privilege error when viewing restricted topics.
Raise a privilege error when trying to view a restricted topic instead
of handling it in the controller. This way error handling is standardized.
2019-09-08 15:32:31 -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
evazion
216243a354 /forum_posts/search: make available to anonymous users. 2017-07-06 19:18:15 -05:00
Type-kun
6a6d16852a Final fix for #2658 - close exploit with "new". 2017-01-16 19:34:31 +05:00
Albert Yi
8db970f9f3 skip api check for forum and comment endpoints 2017-01-10 15:06:34 -08:00
Albert Yi
eb6746a8a8 additional checks on forum topic visibility 2016-11-07 10:48:04 -08: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
d44495ff9e improve janitor/promotion reports, fix bug with forum post counts 2015-06-18 12:04:19 -07:00
Toks
60e1d1379d Fix ?page=1 param appearing after creating/editing forum post
It creates an extra unnecessary entry in back button history to go
through.
2014-11-26 13:27:28 -05:00
r888888888
05c3795e6a fixes #2110 2014-03-19 14:21:53 -07:00
Toks
59aa45e83b fixes #920 2013-10-09 13:05:06 -04:00
Toks
39a6cca62a fixes #1080 2013-07-07 19:29:24 -04:00
Toks
2016e15ce8 fixes #1508 2013-06-30 11:57:30 -04:00
Toks
6a4e425b66 fixes #1811 2013-06-29 11:49:30 -04:00
Toks
e9bee223cc fixes #1776 2013-06-23 12:34:25 -04:00
Toks
9ccf1e0f8f add limit parameter to everything 2013-05-15 01:01:19 -04:00
r888888888
bb88c22257 fixes #1525 2013-05-07 17:29:52 -07:00
Toks
3ef06e555b fixes #1118 2013-04-22 22:03:48 -04:00
albert
541dabaaf6 fixes #1108 2013-03-29 15:37:28 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
69607c0ea8 fixes #920 2013-03-17 20:56:34 -04:00
albert
2f47b01379 add action for marking forum as read 2013-02-24 17:09:07 -05:00
albert
56dd8707fd controller tweaks 2013-02-23 15:58:21 -05:00
albert
3967cf7343 fixes #442 2013-02-23 11:55:11 -05:00
albert
78f1d0f69a fixes to user search 2013-02-21 12:42:41 -05:00
albert
b32f074022 fixes #400 2013-02-19 13:55:20 -05:00
albert
763b792126 fix for edit forum post links 2013-02-19 12:39:32 -05:00
albert
fd14dfb7b5 forum fixes 2013-02-19 12:31:25 -05:00
albert
b8c0cbeed1 restrict deleting forum posts to janitors 2013-02-18 15:59:35 -05:00
albert
eb5e526678 enable uploads 2013-02-17 21:39:15 -05:00
albert
44682156c0 fix searches 2013-02-17 21:09:25 -05:00
albert
2f9db2399c fix for forum topic response 2013-01-24 14:37:39 -05:00
albert
dd5a965884 fixes 2012-03-12 17:50:45 -04:00
albert
3eb06a43c4 fixes #324 2012-02-20 14:25:50 -05:00
albert
a16dfdf0dd fixes 2011-07-09 03:32:18 -04:00
albert
bd520f61f7 forum previews working 2011-03-12 16:09:11 -05:00
albert
21cc1cbafa work on forum 2011-03-11 19:24:19 -05:00
albert
541163685d implemented forum post controller 2011-01-13 18:16:39 -05:00
albert
523cc9fe02 work on forum post controller 2011-01-12 18:21:39 -05:00
albert
a156cc8c62 moved some donmai-specific stuff out of default config 2010-11-19 13:44:11 -05:00
albert
ac98d7db37 stubbed in blank controllers/helpers/functional tests 2010-03-10 18:21:43 -05:00