Commit Graph

38 Commits

Author SHA1 Message Date
evazion
c66f7c4626 post/pool versions: fix database timeouts not being set.
Bug: database timeouts were set only on the main database, not on the
post and pool versions database, so users effectively had an unlimited
timeout when dealing with these things.
2019-09-30 00:58:34 -05:00
evazion
d29bbbbd71 Fix #4178: add ability to mass undo tag edits.
Adds checkboxes to the /post_versions index allowing you to select and
undo multiple versions at once.
2019-09-27 21:02:32 -05:00
evazion
b202985eaa posts/show: make post history pages visible to all. 2019-09-08 23:28:02 -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
Albert Yi
a12f6badde add RequestStore gem, support universal only param for api endpoints (fixes #4068) 2019-04-17 12:00:42 -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
evazion
086b520dcc archives: raise exception if not configured. 2017-04-05 01:17:03 -05:00
r888888888
87ff449f20 fixes #2951: /post_versions is extremely slow 2017-04-03 15:03:59 -07:00
evazion
1ae5b7ba2f post archives: fix N+1 problem when fetching previous version. 2017-04-03 15:03:26 -07:00
evazion
d4b9b66c0e post_versions_controller.rb: fix N+1 queries in post, updater.
Rendering the updater name at post_versions/_listing.html:25 caused
this for each post version:

    SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1

PostArchive#diff caused this for each post version:

    SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 LIMIT 1
2017-03-02 17:47:20 -06:00
r888888888
5676978096 require membership to see post history 2017-03-01 16:29:00 -08:00
Albert Yi
3780645cb2 Merge pull request #2897 from evazion/fix-rescue_from
Remove redundant rescue_from calls.
2017-02-27 16:48:44 -08:00
evazion
40092f21ba Remove redundant rescue_from calls.
These are redundant because ApplicationController rescues these exceptions already.
2017-02-25 02:18:16 -06:00
Albert Yi
5404c1d231 implement postarchive 2017-02-21 13:40:52 -08:00
Toks
5f12a5e555 fixes #2165 2014-05-25 14:50:07 -04:00
Toks
347561c838 fixes #1439 2013-12-09 15:05:12 -05:00
Toks
7726e85e33 fixes #866 2013-06-21 21:55:47 -04:00
Toks
2d0c3d16a3 fix #1724 for posts 2013-06-09 15:18:09 -04:00
Toks
9ccf1e0f8f add limit parameter to everything 2013-05-15 01:01:19 -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
fe97436f81 fix tests 2013-03-11 18:12:27 -04:00
albert
56dd8707fd controller tweaks 2013-02-23 15:58:21 -05:00
albert
b8d93c301a fix for post version pagination 2013-02-21 13:37:56 -05:00
albert
63394ef161 remove unnecessary count query for post_versions listing 2013-02-20 14:18:33 -05:00
albert
359a17674c fixes #429 2013-02-19 14:36:31 -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
3c0a05fc79 fix 2013-01-14 12:44:24 -05:00
albert
5fcd802249 fix post versions controller 2013-01-14 12:08:57 -05:00
albert
12d85416ec fixes #51: Post change search issue 2011-09-14 13:13:28 -04:00
albert
e9bab19d51 changes 2011-06-29 13:06:25 -04:00
albert
07f8dba7f2 work 2011-06-21 12:20:22 -04:00
albert
df20d9233b added unapproval+upload functional test 2011-01-31 18:01:48 -05:00
albert
f7e2344b9f * Reworked how post versioning works, now more closely resembles the 1.18 strategy 2011-01-26 18:10:49 -05:00
albert
f3b4312ef3 * Refactored post history. Each post now has a single history record. This history record has multiple revisions, serialized as JSON in a text field. 2010-11-06 03:08:27 -04:00
albert
ac98d7db37 stubbed in blank controllers/helpers/functional tests 2010-03-10 18:21:43 -05:00