Commit Graph

40 Commits

Author SHA1 Message Date
evazion
2350362183 uploads: add ability to search your uploads by AI tags.
Add ability to search your unposted uploads using AI tags. Like with
media assets, only basic tags are supported (no metatags) and complex
multi-tag searches will probably be slow.

The default AI tag confidence threshold is 50%. There's a hidden
search[min_score] URL param that lets you change this.
2022-07-06 02:01:09 -05:00
evazion
093a808a36 Fix #4986: Add ability to filter images in /media_assets and /uploads depending on if they have become posts 2022-02-18 03:39:08 -06:00
evazion
0b8d042c06 uploads: allow changing thumbnail size on My Uploads / All Uploads pages.
* Add a "Size" menu to the My Uploads / All Uploads pages to allow
  changing the thumbnail size.
* Make the My Uploads / All Uploads pages use the same thumbnail size as
  the post index page.
* Change the "Gallery | Table" links on the My Uploads page to icons.
2022-02-16 16:39:28 -06:00
evazion
054b0b4d0a uploads: add thumbnail view to /uploads listing.
Add a thumbnail view to the /uploads listing. You can click on images to
resume the upload, or go to the post if it's already been posted.
2022-02-02 01:50:34 -06:00
evazion
5d2996d0c2 media assets: add media asset preview component.
Add a view component for rendering thumbnails for media assets.

This lets us properly show thumbnails on the upload listing page and the
media assets listing page, including support for high pixel density thumbnails
and video length icons for videos.

Fixes not being able to see thumbnails on the /media_assets page.

This is mostly copy/pasted from the post preview component. FIXME: don't duplicate code.
2022-01-30 22:39:54 -06:00
evazion
abdab7a0a8 uploads: rework upload process.
Rework the upload process so that files are saved to Danbooru first
before the user starts tagging the upload.

The main user-visible change is that you have to select the file first
before you can start tagging it. Saving the file first lets us fix a
number of problems:

* We can check for dupes before the user tags the upload.
* We can perform dupe checks and show preview images for users not using the bookmarklet.
* We can show preview images without having to proxy images through Danbooru.
* We can show previews of videos and ugoira files.
* We can reliably show the filesize and resolution of the image.
* We can let the user save files to upload later.
* We can get rid of a lot of spaghetti code related to preprocessing
  uploads. This was the cause of most weird "md5 confirmation doesn't
  match md5" errors.

(Not all of these are implemented yet.)

Internally, uploading is now a two-step process: first we create an upload
object, then we create a post from the upload. This is how it works:

* The user goes to /uploads/new and chooses a file or pastes an URL into
  the file upload component.
* The file upload component calls `POST /uploads` to create an upload.
* `POST /uploads` immediately returns a new upload object in the `pending` state.
* Danbooru starts processing the upload in a background job (downloading,
  resizing, and transferring the image to the image servers).
* The file upload component polls `/uploads/$id.json`, checking the
  upload `status` until it returns `completed` or `error`.
* When the upload status is `completed`, the user is redirected to /uploads/$id.
* On the /uploads/$id page, the user can tag the upload and submit it.
* The upload form calls `POST /posts` to create a new post from the upload.
* The user is redirected to the new post.

This is the data model:

* An upload represents a set of files uploaded to Danbooru by a user.
  Uploaded files don't have to belong to a post. An upload has an
  uploader, a status (pending, processing, completed, or error), a
  source (unless uploading from a file), and a list of media assets
  (image or video files).

* There is a has-and-belongs-to-many relationship between uploads and
  media assets. An upload can have many media assets, and a media asset
  can belong to multiple uploads. Uploads are joined to media assets
  through a upload_media_assets table.

  An upload could potentially have multiple media assets if it's a Pixiv
  or Twitter gallery. This is not yet implemented (at the moment all
  uploads have one media asset).

  A media asset can belong to multiple uploads if multiple people try
  to upload the same file, or if the same user tries to upload the same
  file more than once.

New features:

* On the upload page, you can press Ctrl+V to paste an URL and immediately upload it.
* You can save files for upload later. Your saved files are at /uploads.

Fixes:

* Improved error messages when uploading invalid files, bad URLs, and
  when forgetting the rating.
2022-01-28 04:13:22 -06:00
evazion
a26ed9d389 rails: fix #to_s(:human_size) deprecation warnings.
Fix this deprecation warning:

  DEPRECATION WARNING: Integer#to_s(:human_size) is deprecated. Please use Integer#to_formatted_s(:human_size) instead.
2022-01-07 14:24:54 -06:00
evazion
2d976cf557 posts: remove has_dimensions? method.
All posts have non-null width and height now that unsupported filetypes
have been purged.

https://danbooru.donmai.us/forum_topics/18027
2021-09-02 05:58:45 -05:00
evazion
1f637867a4 tags: refactor tag lists to use ViewComponent. 2021-02-05 02:37:02 -06:00
evazion
1b30b71a07 posts: refactor post previews to use ViewComponent.
Refactor the post preview html to use the ViewComponent framework. This
lets us encapsulate all the HTML, CSS, and helper methods for a UI
component in a single place.

See https://viewcomponent.org.
2021-01-14 21:17:57 -06:00
evazion
ed79b623cc Fix #4544: Show limited view of other user's uploads on the upload index.
* Show completed uploads to other users.
* Don't show failed or incomplete uploads to other users.
* Don't show tags to other users.
* Delete completed uploads after 1 hour.
* Delete incomplete uploads after 1 day.
* Delete failed uploads after 3 days.
2020-07-13 19:25:30 -05:00
evazion
20f8a26709 tests: fix rails 2.7 keyword parameter deprecation warnings. 2020-05-25 01:48:46 -05:00
evazion
d675bde187 presenters: inline UploadPresenter. 2020-05-10 19:29:12 -05:00
evazion
5c913d8ad1 table builder: fix various incorrect css classes.
Change calling convention to explicitly indicate whether the attributes
are for the <th> element or the <td> element. Fixes various cases where
the two were mixed up.

* Fix .col-expand classes not being set correctly on the /post_versions,
  /pool_versions, and /notes pages.

* Fix .updater and .updated-at classes not being set correctly on the
  /forum_topics page.

* Fix the name param being ignored (noticeable in the post count field
  on the /tags page).

* Don't pass empty string when column has no name.
2020-01-07 02:40:59 -06:00
BrokenEagle
043944e1dd Convert index tables to using table builder 2020-01-04 22:02:43 +00:00
evazion
f151285038 views: standardize page titles. 2019-08-24 22:55:35 -05:00
evazion
59b277ead1 users: drop id_to_name, name_to_id caching.
Changes:

* Drop Users.id_to_name.
* Don't cache Users.name_to_id.
* Replace calls to name_to_id with find_by_name when possible.
* Don't autodefine creator_name in belongs_to_creator.
* Don't autodefine updater_name in belongs_to_updater.
* Instead manually define creator_name / updater_name only on models that need
  to return these fields in the api.

id_to_name was cached to reduce the impact of N+1 query patterns in
certain places, especially in api responses that return creator_name /
updater_name fields. But it still meant we were doing N calls to
memcache. Using `includes` to prefetch users avoids this N+1 pattern.

name_to_id had no need be cached, it was never used in any performance-
sensitive contexts.

Avoiding caching also avoids the need to keep these caches consistent.
2019-08-18 11:24:42 -05:00
evazion
99632d5e8a TagSetPresenter: refactor to pass options explicitly.
Refactor tag_list_html, split_tag_list_html, and inline_tag_list_html to
take the `show_extra_links` and `current_query` options explicitly,
rather than implicitly relying on CurrentUser or taking `params[:tags]`
from the template.
2018-09-30 21:52:24 -05:00
Albert Yi
762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
Albert Yi
b56681a609 refactor solution for #3804 2018-08-07 13:31:45 -07:00
Albert Yi
d053e135ab fix leaked ip addresses in upload status (#3804) 2018-08-07 13:18:31 -07:00
r888888888
334d8b7c6f Add alt_source field on uploads to deal with twitter galleries 2018-08-04 16:32:15 -07:00
Albert Yi
099654b2da truncate sources on upload listing 2018-07-06 11:02:26 -07:00
evazion
442964b0eb tag_set_presenter: refactor split_tag_list_html.
* Make category headers optional.
* Make category order configurable.
* Clean up code.
2018-04-25 22:12:10 -05:00
evazion
c9acbbdf9e uploads: revamp /uploads listing UI (#3657).
* Add thumbnails.
* Colorize tags.
* Rearrange columns.
* Add rating/source/size/dimensions info.
* Add "»" search drilldown links.
2018-04-20 15:52:09 -05:00
evazion
e6ce05eb29 uploads: add more search options for /uploads listing (#3657). 2018-04-20 15:51:56 -05:00
evazion
ff4616e7b2 uploads: add upload-specific secondary links. 2018-04-20 15:51:56 -05:00
Toks
8b33cac661 replace old user links with new format 2013-04-04 23:16:28 -04:00
Toks
4099dd30d9 adds user level classes to upload index 2013-04-04 18:56:03 -04:00
小太
1a03a86592 Kill trailing whitespace in erb files 2013-03-19 23:11:58 +11:00
albert
0595019958 change relative times to absolute on listings 2013-03-13 16:25:08 -04:00
albert
5d529bf4da fix for update related tags 2013-02-20 10:23:50 -05:00
albert
ff68644a2e add inline forum editing 2013-02-17 14:12:31 -05:00
albert
34ae712be0 fixed titles 2011-10-23 16:55:57 -04:00
albert
5f6f2fa659 add striping to upload index 2011-09-24 11:07:29 -04:00
albert
24bf21540a refactoring views 2011-08-16 18:47:01 -04:00
albert
c8afd34d15 added ip addr search 2011-07-29 18:04:50 -04:00
albert
1ad075c05a post index noe works 2011-06-24 18:22:54 -04:00
albert
acdce69f20 more work 2010-10-19 19:34:31 -04:00
albert
dcf8d0df4c fixed upload->post converion process 2010-03-17 19:20:44 -04:00