Commit Graph

175 Commits

Author SHA1 Message Date
evazion
2341d8341d posts: fix flagged posts not having red thumbnail borders for approvers. 2022-10-31 02:39:45 -05:00
evazion
57316dc622 css: fix autoprefixer warning about flex-end. 2022-10-27 04:17:45 -05:00
evazion
0d835983ce reports: fix error when report is empty.
Fix an exception when a report is empty, for example when performing a
tag search that returns no results:

* https://betabooru.donmai.us/reports/posts?search[group]=uploader&search[tags]=does_not_exist
2022-10-23 21:55:06 -05:00
evazion
203067b5ed reports: add non-timeseries charts.
Add bar charts for non-timeseries data. For example, a bar chart of the
top 10 uploaders overall in the last month, rather than a timeseries
chart of the number of uploads per day for the last month.
2022-10-23 04:42:51 -05:00
evazion
f73d2e3956 reports: add ability to group reports by column.
Add ability to group reports by various columns. For example, you can see
the posts by the top 10 uploaders over time, or posts grouped by rating
over time.
2022-10-22 04:05:10 -05:00
evazion
7646521d0f Add basic tables and graphs for various tables.
Add basic tables and graphs for viewing things like uploads over time, new users
over time, comments over time, etc. Located at https://betabooru.donmai.us/reports.

The graphing uses Apache ECharts: https://echarts.apache.org/en/index.html.
2022-10-20 05:20:22 -05:00
evazion
3b0e94040f posts: fix placeholder thumbnail for Flash files.
* Replace the "Download" placeholder thumbnail for Flash files with a
  new placeholder that specifically says it's a Flash file.
* Fix a bug where the Flash placeholder thumbnail was too small when
  using larger thumbnail sizes.
* Fix it so that media assets don't falsely consider Flash files to have
  thumbnails. This could potentially cause errors if someone tried to
  expunge, replace, or regenerate a Flash post.
2022-10-16 16:46:18 -05:00
evazion
4b5d4e5c20 thumbnails: remove crossorigin="anonymous" html attribute.
Possible fix for images not loading when Cloudflare Managed Challenges are enabled.
`crossorigin="anonymous"` prevents the `cf_clearance` cookie from being passed (maybe?).
2022-10-14 02:11:39 -05:00
evazion
2429d6c961 comments: let users see their own name on their own deleted comments.
* Let the user see their own username when viewing their own deleted comments.
* Don't hide the creator_id field from the comment creator in the API.
* Hide the score, do_not_bump_post, and is_sticky fields for deleted
  comments in the HTML and in the API, unless the user is a moderator.
* Hide the "..." popup menu on deleted comments, unless the user is a moderator.

This is so that when a user looks at their own comment history, their
name isn't hidden from them on their own deleted comments. This may confuse
users however into thinking their name is still visible to other users.
2022-09-22 20:01:17 -05:00
evazion
a80ee22746 autocomplete: fix incorrect highlighting when tag contains repeated words.
Fix tags like `short_shorts` or `hunter_x_hunter` being highlighted
incorrectly. Typing `short_sh` would highlight it as SHort_SHorts
instead of as SHORT_SHorts.
2022-09-06 18:01:30 -05:00
evazion
4a77d67d1f autocomplete: fix completion of ai: metatag.
Fix it so we don't show the `ai:` prefix in front of results in the
autocomplete menu when completing the `ai: metatag.
2022-09-03 20:34:34 -05:00
evazion
f83af31a00 autocomplete: fix usernames not being highlighted in @mentions.
Fix usernames not being highlighted when completing @mentions.

This also changes it so the autocomplete results don't include the '@'
in front of the name.

Minor breaking change to the /autocomplete.json API. Autocomplete
results for mentions now have the type `mention` instead of `user`.
2022-09-03 20:34:26 -05:00
evazion
f20e1d5bc9 autocomplete: fix highlighting of short searches.
Fix a bug where tags weren't highlighted correctly when the search only contained one character.
2022-09-02 14:15:25 -05:00
evazion
6b6c452ea2 autocomplete: remove unused html data attributes.
Remove the `data-autocomplete-antecedent`, `data-autocomplete-category`,
and `data-autocomplete-post-count` data attributes from the autocomplete
menu. These weren't used by Danbooru itself and they bloat the HTML.
2022-09-02 13:56:53 -05:00
evazion
3d831f7e1c autocomplete: limit width of autocomplete menu.
Limit the width of the autocomplete menu to 480px. This is so that
stupidly long isekai titles don't blow out the size of the menu when
searching for common words.

For example, when searching for "look", one of the results is:

   no_matter_how_you_look_at_it_it's_your_fault_that_i'm_not_popular! -> watashi_ga_motenai_no_wa_dou_kangaetemo_omaera_ga_warui!
2022-09-02 13:56:53 -05:00
evazion
8491bef6e6 autocomplete: highlight matches in autocomplete menu.
Highlight the matching part of the tag in the autocomplete menu. For
example, if you search "hair", then the word "hair" will be bolded in
every matching tag. This is so users can tell why a particular tag was
matched.
2022-09-02 13:56:52 -05:00
evazion
cf13ab1540 autocomplete: render html server-side.
Render the HTML for autocomplete results server-side instead of in
Javascript. This is cleaner than building HTML in Javascript, but it may
hurt caching because the HTTP responses are larger.

Fixes #4698: user autocomplete contains links to /posts

Also fixes a bug where tag counts in the autocomplete menu were different
from tag counts displayed elsewhere because of differences in rounding.
2022-08-30 01:26:02 -05:00
evazion
e1df93c4dc Fix #5073: Navigating search containing pool tag only uses pool
Show the search navbar when searching for `pool:1234 tag`. Before the
search navbar would always be hidden if the search contained a pool:
metatag, even if it was a multi-tag search.
2022-08-28 23:17:46 -05:00
evazion
fa0d7990fb posts: fix selected pool not being highlighted when doing pool:<name> search.
Fix the pool name not being bolded in the pool navbar when doing a
pool:<name> search. Previously the selected pool was only bolded when
doing a pool:<id> search.
2022-08-28 23:16:45 -05:00
evazion
c199c7eab7 ai tags: adjust thumbnail layout. 2022-06-26 20:37:35 -05:00
evazion
f35bc60e51 posts: add hidden 540px thumbnail size option.
Add a hidden option for 540px size thumbnails. This option currently
isn't listed in the thumbnail size menu, but it can be enabled with an
URL param: https://danbooru.donmai.us/posts?size=540.
2022-06-26 20:37:32 -05:00
evazion
7b1f6e42c1 posts: add "Absurd" size option to thumbnail size menu.
Add option for "Absurd" (720px) size thumbnails to the thumbnail size
menu. 720px size thumbnails require .webp support so they won't work in
older browsers.
2022-06-25 21:53:27 -05:00
NamelessContributor
c762e3ddbc Add data-is-deprecated attribute to tags
Allows using custom CSS to highlight deprecated tags, fixes #5110
2022-05-10 17:17:15 +02:00
evazion
cd22c8eb1a posts: eliminate unnecessary favgroup query on posts show page.
Eliminate a SQL query loading the post's favgroups if the current user
is anonymous (and therefore can't have favgroups).
2022-04-18 00:18:54 -05:00
evazion
363cf2014b views: fix deprecated calls to ViewComponent#with_variant. 2022-04-13 00:18:53 -05:00
evazion
823fa5c6e9 search: switch to new tag search parser in a few places. 2022-03-29 18:21:47 -05:00
evazion
8b2798d487 Merge pull request #5068 from NamelessContributor/patch-1
tag_list_component: fix overflow of some long tags
2022-03-27 02:29:37 -05:00
evazion
4ef8178bd1 sources: remove canonical_url method.
Refactor source strategies to remove the `canonical_url` method.

`canonical_url` returned the URL that should be used as the source of
the post after upload. Now we simply use `Source::URL#page_url` to
determine the source after upload. If the source is an image URL that is
convertible to a page URL, then the image URL is used as the source. If
the source is an image URL that is not convertible to a page URL, then
the page URL is used as the source.

This simplifies source strategies so that all they have to care about is
implementing the `Source::URL#page_url` and `Sources::Strategies#page_url`
methods, and the preferred source will be chosen for posts automatically.
2022-03-23 23:38:06 -05:00
NamelessContributor
136e2777cb tag_list_component: fix overflow of some long tags
Fixes rare cases of tags containing a long word overflowing outside the sidebar e.g.
https://danbooru.donmai.us/posts?tags=iwakiyamayukisatoshironanogojuurokushi_akira
2022-03-23 11:37:10 +01:00
NamelessContributor
c9e3c293a9 Always add animate-spin class to spinner_icon
This also fixes the source data and fav button spinners not spinning
after commit 77515915a4
2022-03-08 08:54:45 +01:00
evazion
8ef05ec69b Fix #5021: Downvoting/upvoting a revealed hidden comment will hide it again.
Fix it so that upvoting or downvoting a revealed thresholded comment
doesn't hide it again.

The fix is to explicitly store a `data-show-thresholded` flag on the
comment, instead of manually hiding elements with jQuery, and to morph
the comment HTML instead of replacing it so that the state isn't lost
after voting. Alpine.js is used for this, which isn't strictly necessary,
but is useful to test the library before adopting it on a wider scale.

https://alpinejs.dev/start-here
2022-02-28 20:11:22 -06:00
evazion
202dfe5d87 uploads: allow uploading multiple files from your computer at once.
Allow uploading multiple files from your computer at once.

The maximum limit is 100 files at once. There is still a 50MB size limit
that applies to the whole upload. This limit is at the Nginx level.

The upload widget no longer shows a thumbnail preview of the uploaded
file. This is because there isn't room for it in a multi-file upload,
and because the next page will show a preview anyway after the files are
uploaded.

Direct file uploads are processed synchronously, so they may be slow.

API change: the `POST /uploads` endpoint now expects the param to be
`upload[files][]`, not `upload[file]`.
2022-02-19 00:00:56 -06:00
evazion
e37dd3a6d0 uploads: change loading indicator for thumbnails.
Use a spinner icon instead of the word "Loading" for thumbnails that are
being processed in the background in a batch upload.

Also use morphdom to update thumbnails so we only update the parts of
the DOM that actually changed.
2022-02-18 16:03:43 -06:00
evazion
77515915a4 uploads: change loading indicator for upload widget.
Change the loading indicator from a progress bar to a spinner. Fixes
issue with the <progress> element having a different appearance on
different browsers.
2022-02-18 03:39:08 -06:00
evazion
f54fac74c8 Add image icon next to thumbnail size dropdown menu. 2022-02-17 20:31:59 -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
36265dbff0 uploads: autorefresh thumbnails on multi-file uploads page.
Automatically refresh thumbnails on the multi-file upload page as images
are processed in the background.
2022-02-15 00:59:30 -06:00
evazion
53a3beee35 uploads: refactor "My Uploads" page for multi-file uploads.
* Make thumbnails on the "My Uploads" page show an icon with an image
  count when an upload contains multiple files.

* Make the "My Uploads" page show each upload, not each individual file.
  If an upload contains multiple files, they're shown grouped together
  under a single upload. This does mean that failed or duplicate uploads
  will show up on this page now. This is because this page shows each
  upload attempt, not each uniquely uploaded file.
2022-02-14 00:41:07 -06:00
evazion
879363b585 media assets: show placeholder thumbnail when image is missing.
Make media assets show a placeholder thumbnail when the image is
missing. This can happen if the upload is still processing, or if the
media asset's image was expunged, or if the asset failed during upload
(usually because of some temporary network failure when trying to
distribute thumbnails to the backend image servers).

Fixes a problem where new images on the My Uploads or All Uploads pages
could have broken thumbnails if they were still in the uploading phase.
2022-02-14 00:41:07 -06:00
evazion
7bbe6e9d22 artists: make artist pages less shit.
* Group URLs by site.
* List most important URLs first and dead URLs last.
* Add site icons next to URLs.
* Put other names and group name beneath the artist name, instead of beneath the wiki.
2022-02-08 22:20:01 -06:00
evazion
67d834775d js: add symlinks for component .js files.
Followup to ef0d8151d. Add symlinks from app/components/**/*.js to
app/javascript/src/javascripts/*.js so you can still see a component's
Javascript inside the component.
2022-02-08 14:21:32 -06:00
evazion
ef0d8151d8 js: reorganize Javascript file structure.
Move Javascript files from app/components/**/*.js back to app/javascript/src/javascripts/*.js.
This way Javascript files are in one place, which simplifies import paths and makes it
easier to see all Javascript at once.
2022-02-08 14:15:35 -06:00
evazion
3f64808432 Merge pull request #5000 from NamelessContributor/patch-1
Show file extension next to file size in post preview
2022-02-07 16:21:17 -06:00
evazion
1a61e329ba uploads: add column for error messages.
Change it so uploads store errors in an `error` column instead of in the
`status` field.
2022-02-07 15:44:39 -06:00
NamelessContributor
49f71122fc Show file extension next to file size in post preview 2022-02-07 10:47:13 +01:00
evazion
00d2b70670 uploads: fix back button behavior when not using bookmarklet.
Better fix for 8173c73aa. When not using the bookmarklet, make the back
button on the upload tagging page take you back to the new upload page.
When using the bookmarklet, make it take you back to the source.
2022-02-05 23:52:55 -06:00
evazion
2b1c58c959 Fix #4987: Can't populate tag string from upload url anymore.
Usage: https://danbooru.donmai.us/uploads/new?url=...&post[tag_string]=...&post[rating]=...

* Pass the URL parameters from the /uploads/new page to the /uploads/:id page.
* Fix the /uploads/:id page throwing an "unpermitted parameters" error
  when given URL params for the post edit form.
2022-02-03 19:41:04 -06:00
evazion
8173c73aa3 uploads: fix back button re-uploading the file when using bookmarklet.
Fix a bug where, if you used the bookmarklet to upload a file, and you
clicked on the back button on the upload tagging page, then you would be
taken back to the upload page, which would autosubmit the upload again.

Now if you click the back button on the upload tagging page, you'll be
taken back to the page where you used the bookmarklet, not the upload page.
2022-02-03 17:28:51 -06:00
evazion
280885e8e8 forum posts: fix the "post reply" link scrolling to top of page.
Fix regression in 6fbca01a2.

Also make it so the "reply" link automatically inserts the cursor into
the reply box. Do this for both forum posts and comments. Before it only
did this when quoting a post, not when creating a new post.
2022-02-03 14:19:11 -06:00
evazion
92a4d045e2 media assets: add thumbnail view to /media_assets page.
Add a thumbnail view to the /media_assets page. This page lets you see
all images uploaded to Danbooru by all users (although you can't see who
the uploader is). Also add a link to this page in the subnav bar on the
upload page.
2022-02-02 01:12:56 -06:00