Commit Graph

2186 Commits

Author SHA1 Message Date
evazion
4233d2149f Fix delete_all / destroy_all calls. 2018-04-11 22:33:11 -05:00
Albert Yi
d9d98f05c2 Merge branch 'rails-5.1' 2018-04-11 11:40:36 -07:00
evazion
40827442c7 Fix #3614: IQDB: don't index placeholder thumbnails. 2018-04-08 12:15:24 -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
e7eee185f7 Fix #3607: Webm / mp4 uploads broken. 2018-04-06 19:55:26 -05:00
evazion
084fcd91ed Only generate tagged filenames for URLs on post show pages (#3597).
Don't generate tagged filenames for urls in the data attributes on
thumbnails, or in the /posts.json api.
2018-04-05 14:20:37 -05:00
evazion
14977397fb Fix "ArgumentError - wrong number of arguments" during tagging. 2018-04-05 13:27:37 -05:00
Albert Yi
b219992b7d add async processing for top tagger 2018-04-03 16:00:36 -07:00
evazion
8fd9d374ca Fix #3583: Copying notes should copy tags to destination. 2018-03-31 12:58:56 -05:00
evazion
8e7ad9eb97 Post#copy_notes_to: wrap in transaction. 2018-03-31 11:44:49 -05:00
evazion
75cc1421a3 Fix #3590: Superfluous space added on certain autocompletions.
Bug: searching for /wiki_pages?search[title]=touhou%20 didn't find the
'touhou' wiki. The space wasn't stripped when the title was normalized.
2018-03-30 22:24:34 -05:00
evazion
c0c41dd369 uploads: add limits on max image dimensions. 2018-03-29 19:24:41 -05:00
evazion
dc9b7e5bda Fix #3582: Switch from ImageMagick to libvips 2018-03-28 17:15:57 -05:00
evazion
41a4ff15cd posts: remove unused file path / url methods.
* Remove file_path_for, cropped_file_url (dead code)
* Remove complete_preview_file_url (preview_file_url now returns absolute links)
* Remove `file_name` (only used for Download link in sidebar)
2018-03-20 19:49:55 -05:00
evazion
b7f7187f63 posts: use storage manager to delete files. 2018-03-20 19:49:06 -05:00
evazion
f0bf1bc66e posts: use storage manager to backup files.
* Perform backups synchronously inside `distribute_files` instead of
  asynchronously in `queue_backup`. Asynchronous backups assumed that
  files are stored on the local filesystem, which isn't true in general.

* Remove obsolete backup service classes.
2018-03-20 19:49:06 -05:00
evazion
6d0d1a3ce9 posts: use storage manager to build file urls. 2018-03-20 19:49:06 -05:00
evazion
c76463f34d uploads: use storage manager to distribute files.
Refactors the upload process to pass around temp files, rather than
passing around file paths and directly writing output to the local
filesystem. This way we can pass the storage manager the preview /
sample / original temp files, so it can deal with storage itself.

* Change Download::File#download! to return a temp file.

* Change DanbooruImageResizer and PixivUgoiraConverter to accept/return
  temp files instead of file paths.

* Change Upload#generate_resizes to return temp files for previews and samples.

* Change Upload#generate_resizes to generate ugoira .webm samples
  synchronously instead of asynchronously.
2018-03-20 19:49:06 -05:00
evazion
60dcfbfbdd uploads: autotag animated_gif/png during upload.
Move animated_gif / animated_png autotagging to take place during
uploading, instead of during tag editing. We can't generally assume the
file will be present on the local filesystem after uploading.
2018-03-20 19:49:06 -05:00
evazion
2286ccfca8 uploads: clean up process_upload.
* Remove `initialize_status` (status already defaults to pending in database)
* Remove `has_dimensions?` (always returns true)
* Remove `async_conversion?` (dead code)
* Remove `validate_file_exists` (unneeded checks)
* Simplify `calculate_dimensions`
* Merge `file_header_to_content_type` with `content_type_to_file_ext` (content type isn't used elsewhere)
2018-03-20 19:49:06 -05:00
evazion
8a012d4c91 Remove unused mobile mode code (#3206).
Mobile mode was removed in 31e36cf.
2018-03-20 02:29:06 -05:00
Albert Yi
418b2beae5 Merge pull request #3566 from r888888888/most-valued
Post taggers
2018-03-08 16:01:40 -08:00
r888888888
3657cacd17 * post keeper is calculated synchronously
* add fallback mechanism in case archive service is not up
* pass along most recently added tags to any keeper calculation
2018-03-08 16:00:44 -08:00
r888888888
0c5dcbbf68 Revert "Revert "implement post keepers""
This reverts commit b9fcfe0442.
2018-03-06 18:04:31 -08:00
evazion
5113aec937 artist finder: fix bogus matches for nijie. 2018-03-03 11:26:15 -06:00
evazion
78aba1c5b1 Fix #3554: approving BUR with nil forum_post_id doesn't update forum.
Wrap `approve!` and `reject!` in transactions so that if there's an
error in approving or rejecting a BUR, it leaves the BUR's status
unchanged instead of updating the BUR but not updating the forum.
2018-02-24 15:04:57 -06:00
evazion
2b8767d7f4 BulkUpdateRequest#approve!: don't swallow exceptions.
Rescue `AliasAndImplicationImporter::Error` instead of `Exception`.
2018-02-24 14:37:02 -06:00
r888888888
689b5690bf fixes #3560 2018-02-22 11:15:42 -08:00
evazion
f07aa1b170 bulk update requests: convert to strong params. 2018-02-18 12:12:12 -06:00
evazion
e8ab5cdc4c Fix pool version ordering.
Pool version IDs aren't in the right order; order by updated_at instead.
2018-02-08 16:53:02 -06:00
Albert Yi
b9fcfe0442 Revert "implement post keepers" 2018-02-07 12:28:56 -08:00
Albert Yi
2e62916832 Merge pull request #3529 from r888888888/most-valued
implement post keepers
2018-02-07 12:10:38 -08:00
r888888888
ba6e3f4a0e gracefully handle bad connection errors to replica db ref #3212 2018-02-05 15:05:21 -08:00
evazion
f2a7d3c41a /janitor_trials, /ip_bans: fix default ordering. 2018-02-04 16:48:35 -06:00
evazion
dac095f318 /user_feedbacks: change default order to created_at.
Order by created_at instead of by id because old feedbacks aren't in id order.
2018-02-04 16:43:00 -06:00
r888888888
32cc508edb hide uploader information on posts/show page, add keeper information 2018-02-01 14:38:03 -08:00
Albert Yi
a114af107f Merge pull request #3526 from BrokenEagle/fix-mod-actions
Fix mod actions
2018-01-30 11:40:54 -08:00
BrokenEagle
3933c273c4 Add mod action for move favorites 2018-01-30 11:27:28 -08:00
BrokenEagle
92f7bb46a2 Add missing mod action category 2018-01-30 11:27:24 -08:00
Albert Yi
47bd812811 Merge pull request #3525 from BrokenEagle/fix-index-default-order
Fix index default order
2018-01-29 13:11:24 -08: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
5ea61c6921 /bans: fix undefined ordering when no params are passed.
Fixes the /bans listing being ordered randomly by default.
2018-01-28 15:38:12 -06:00
evazion
100c1d2828 Fix #3523: Feedback notification dmails should include the text of the feedback. 2018-01-28 14:32:38 -06:00
evazion
64186c004f Add pbs.twimg.com to artist finder blacklist.
ref: https://danbooru.donmai.us/forum_topics/14938.
2018-01-26 18:30:18 -06:00
evazion
f8a5620768 Partial fix for #3514: Handle https://twitter.com/i/web/status/:id URL. 2018-01-23 23:07:21 -06:00
Albert Yi
9f578b3270 Merge pull request #3504 from BrokenEagle/fix-3494
Fix how cosplay tags are handled
2018-01-18 12:47:02 -08:00
evazion
989854b3dd Fix #3507: Include ban length in feedback. 2018-01-17 19:53:49 -06:00
BrokenEagle
f626c7ebd7 Fix how cosplay tags are handled 2018-01-15 18:01:06 -08:00
Albert Yi
7ca3d2735c Merge pull request #3495 from BrokenEagle/fix-missing-super-search
Fix missing controllers for search[id] (Ref #3430)
2018-01-15 11:11:24 -08:00
Albert Yi
dfd343f70e Merge pull request #3496 from BrokenEagle/feat-mod-action-event-ids
Add categories to mod actions
2018-01-15 11:09:38 -08:00