Commit Graph

72 Commits

Author SHA1 Message Date
evazion
2c33539be7 uploads: allow searching uploads and media assets by metatag.
Allow searching the /uploads and /media_assets pages by the following metatags:

* id:
* md5:
* width:
* height:
* duration:
* mpixels:
* ratio:
* filesize:
* filetype:
* date:
* age:
* status:<processing|active|deleted|expunged|failed> (for /media_assets)
* status:<pending|processing|active|failed> (for /uploads)
* is:<filetype>, is:<status>
* exif:

Examples:

* https://betabooru.donmai.us/media_assets?search[ai_tags_match]=filetype:png
* https://betabooru.donmai.us/uploads?search[ai_tags_match]=filetype:png

Note that in /uploads search, the id:, date:, and age: metatags refer to the upload media asset, not
the upload itself.

Note also that uploads may contain multiple assets, so for example searching uploads by
`filetype:png` will return all uploads containing at least one PNG file, even if they contain other
non-PNG files.
2022-12-07 01:02:19 -06:00
evazion
3c2a379d6f uploads: replace old upload limits with new upload limits. 2020-02-03 22:05:58 -06:00
Albert Yi
e551ff9b0c fix tests 2018-06-20 11:11:46 -07:00
Albert Yi
fdd7582fb0 add support for upload preprocessing 2018-06-14 17:52:41 -07:00
Albert Yi
6acaf999a1 additional error handling in tests 2018-05-15 17:25:55 -07:00
Albert Yi
0f2e6a9a1b fix tests 2018-05-09 12:45:37 -07:00
Albert Yi
79ea6f7e6c Add Docker and Travis config files to enable CI tests
Also fixes some Rails 6.0 deprecation warnings
2018-05-09 09:56:38 -07:00
evazion
c584ca5b19 Fix uploads getting stuck in 'processing' state (fix #3659).
Bug: if an upload timed out while downloading the file, Upload#process!
would catch the error and attempt to retry, but since the upload was
already in the 'processing' state, on the second try `process!` would
bail out immediately and leave the upload stuck in the 'processing' state.

Fix: remove the retry logic from Upload#process!. Let Downloads::File#download!
(which had its own retry logic) handle it instead.
2018-05-05 11:42:40 -05:00
evazion
0836e4b850 tests: fix upload tests.
Fix some uploads tests that got mixed up when merging abce4d2 (see also d089be9).
2018-05-05 11:20:21 -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
01eda51020 tests: add webm/mp4 upload tests. 2018-04-06 19:56:17 -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
619a2055fe tests: add storage manager tests. 2018-03-20 19:49:58 -05:00
evazion
d089be9f8a tests: fix upload tests. 2018-03-20 19:49:58 -05:00
evazion
4f543671a2 tests: move test/helpers to test/test_helpers.
The Rails convention is for test/helpers to be used for testing the view
helpers in app/helpers. We were using it to store certain utility
methods instead. Move these to test/test_helpers so that test/helpers
can be used for its intended purpose.
2018-01-14 16:11:15 -06:00
evazion
22980c845a tests: fix pixiv ugoira urls. 2017-07-25 00:36:18 -05:00
evazion
ef76ec0385 uploads: fix upload failure when given nil source (fix #3168). 2017-06-17 08:31:44 -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
9b16c45edc test_helper.rb: factor out upload test helpers. 2017-02-04 17:18:52 -06:00
evazion
beddc34958 tests: set Delayed::Worker.delay_jobs = false globally. 2017-02-04 17:18:51 -06:00
Albert Yi
0ea7d78584 remove usage of vcr cassettes; delete unused fixtures; fix some broken unit tests 2016-12-28 15:47:28 -08:00
r888888888
fc7afd44ea refactor source pixiv test
refactor pixiv download tests
refactor upload test
refactor nico seiga test
refactor twitter tests
2016-09-28 11:25:29 -07:00
r888888888
3df9f0cdf6 fix unit tests 2015-09-23 12:13:14 -07:00
r888888888
66dd4f072e update tests 2015-06-02 19:20:48 -07:00
r888888888
2ddc93723c fixes #2327 2015-06-02 19:20:09 -07:00
r888888888
ceaa98b105 fix tests 2015-05-21 12:11:11 -07:00
r888888888
177ef0ebcc fixes #2307 2014-11-19 17:17:26 -08:00
evazion
9f96965bb4 Add test case for rewriting ugoira URLs. 2014-10-28 22:57:00 -05:00
r888888888
8d4c9d7955 fix pixiv tests 2014-10-22 17:22:36 -07:00
r888888888
3bb06c2be4 integrate ugoiras into zip+webm+preview 2014-10-19 02:30:02 -07:00
r888888888
fb2219d4ac integrate ugoira converted into upload flow 2014-10-19 02:30:01 -07:00
evazion
8e2be03a6b Fix upload tests to use VCR. 2014-10-05 14:11:31 -05:00
evazion
268f79c3d9 Make VCR disallow unexpected HTTP requests.
This makes it so that tests fail when they make HTTP requests they
aren't expected to. Update these tests so that they use VCR like they
should.
2014-10-04 12:45:37 -05:00
r888888888
f65691b5e6 fix tests 2014-06-18 16:51:55 -07:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
Toks
afa4e83d9b Auto-add automatic tags whenever post is updated
Instead of being limited to when it's first uploaded.
2013-12-15 19:39:10 -05:00
Toks
ba88aaad49 #2025: update tests 2013-11-17 21:25:11 -05:00
r888888888
b945c757c8 fixes #1905 2013-08-05 15:43:55 -07:00
r888888888
c520c7f03c fixes #1847 2013-07-11 15:50:51 -07:00
r888888888
00034f1a17 refactored favorites 2013-04-18 20:19:11 -07:00
r888888888
6caa0f0436 fix tests 2013-04-14 22:24:55 -07:00
albert
a4b67fa072 fix tests and typo bugs 2013-03-22 18:54:37 -04:00
albert
5ba535efd3 fix text 2013-03-21 15:21:07 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
61cd492d4e fix tests 2013-03-12 17:01:52 -04:00
albert
5560d79d5c fixes #108 2013-03-09 01:23:40 -05:00
Peter Graham
a725c81e1e Upload#is_downloadable? returns true for https sources 2013-02-22 23:08:31 -08:00
albert
8749c43b3e refactored search 2013-01-10 17:45:52 -05:00