Commit Graph

59 Commits

Author SHA1 Message Date
evazion
07e23204b6 rubocop: fix various Rubocop warnings. 2021-06-17 04:17:53 -05:00
Thayol
6e2a5c6dde Mobile uncropped thumbnails: Fix sizing and overflow (#4818)
Fix #4460: Disabling cropped thumbnails is broken #4460

* Change width/height to max-width/max-height
* Change for cropped too
2021-06-17 04:09:20 -05:00
evazion
ffbf7f1ccf tests: fix broken tests. 2021-05-15 02:48:13 -05:00
evazion
ca8bfb9149 Update Ruby gems and Yarn packages. 2021-05-15 02:48:13 -05:00
evazion
a2f3ba695c Revert "fix vote buttons."
This reverts commit a0b6047d00.
2021-04-02 03:58:14 -05:00
evazion
a0b6047d00 fix vote buttons. 2021-03-31 23:20:49 -05:00
evazion
b3c1c753b3 comments: allow admins to remove comment votes (fix #4640)
Allow admins to remove comment votes by other users. This is done by
clicking the comment score to get to the comment vote list, then
clicking the Remove button on every vote.
2021-03-30 00:10:25 -05:00
evazion
6b91e55283 comments: allow votes to be soft deleted.
Make it so that when a user removes their own vote, the vote is soft
deleted (the is_deleted flag is set) instead of hard deleted.

Changes:

* Add is_deleted flag to comment votes.
* Relax uniqueness constraint so you can have multiple deleted votes on
  the same comment. You can still only have one active vote on the comment.
* Add `soft_delete` method to Deletable concern.
2021-03-30 00:10:22 -05:00
evazion
53fdf66922 Fix #4755: No navigation bar (prev/next button) when favgroup in query.
Fix the favgroup navbar not being shown when doing a `favgroup:<id>`
search for a public favgroup belonging to another user.
2021-03-08 01:30:00 -06:00
evazion
fee7ed506b comments: put sticky option in popup menu instead of in edit form.
Put the option to sticky a comment in the "..." popup menu instead of
in the comment edit form. This makes it more consistent with deleting or
undeleting a comment.

Also fix a bug where the comment undelete icon didn't show up due to a
typo.
2021-03-07 20:13:38 -06:00
evazion
7b60a476e5 sources: add artist profile links to fetch source data box.
Add site icons linking to all the artist's sites in the fetch source
data box.

Some artist entries have a large number of URLs. Various heuristics are
applied to try to present the most useful URLs first. Dead URLs and
redundant URLs (Pixiv stacc and Twitter intent URLs) are filtered out.
Remaining URLs are sorted first by site (to put sites like Pixiv and
Twitter first), then by URL (to break ties when an artist has multiple
accounts on the same site).

Some sites have shitty hard-to-read icons. It can't be helped. The icons
are the official favicons of each site.
2021-02-26 01:24:30 -06:00
evazion
e1ef94faf7 sources: factor out 'Fetch source data' box into view component. 2021-02-26 01:24:30 -06:00
evazion
4dd1a05208 related tags: fix tag toggling UX.
* Use -webkit-text-stroke instead of bold to indicate selected tags.
  Bold causes the tag to change width, which is jarring and can cause
  the tag to wrap around to a new line. -webkit-text-stroke doesn't
  change the tag's width. Despite the name, this property is widely
  supported.

* Don't wrap the checkbox in a label. In combination with flexbox, this
  made the hitbox for the tag too big. You could click on empty space
  outside the tag and it would still toggle the tag.
2021-02-23 17:45:43 -06:00
evazion
ac05da8de6 posts: change how the mode menu indicates the active mode.
Instead of changing the background color of the entire page when you
change modes in the post mode menu (which was ugly, and not obvious what
the colors meant), show a notice and make it so that hovering a post
gives it a blue outline. This indicates that clicking the post will do
something different.
2021-02-23 07:14:49 -06:00
evazion
177de7c234 related tags: use checkboxes to indicate selected tags.
In the related tags list, use checkboxes and bold to indicate selected
tags, instead of highlighting selected tags with a blue background.

This is so that you can see the colors of selected tags in the related
tags list, and in particular so you can see the artist tag.
2021-02-23 05:38:12 -06:00
evazion
b9ea9d2f5a css: fix styling of selected post in parent/child box.
* On the post show page, in the parent/child box, change it so that
  currently selected post is more visible. Use a light blue outline
  around the current post instead of a dark semi-transparent border.

* Fix it so that there's less empty space around thumbnails in the
  parent/child box.
2021-02-22 02:38:26 -06:00
evazion
4ef30844f6 views: factor out humanized_number helper.
* Render counts in the user profile tooltip the same way as tag counts.
* Render tag counts in the tags index page the same way as tag counts in
  the tags list.
2021-02-18 19:16:41 -06:00
evazion
981d56c97c paginator: fix switching to sequential pagination.
Fix a bug where the paginator didn't correctly switch to sequential
pagination when reaching the page limit.
2021-02-18 19:01:45 -06:00
evazion
4e6dff782d paginator: fix page 1 shown twice in empty searches.
Fix a bug where page 1 was shown twice (once for the current page, and
once for the last page) in searches that returned 0 results.
2021-02-18 18:55:27 -06:00
evazion
c1805cc4e0 views: factor out paginator component.
* Refactor the paginator into a ViewComponent.
* Fix inconsistent spacing between paginator items.
* Fix a bug where the sequential paginator generated the wrong next /
  previous page links in the <link rel="{next|prev}"> tags in the <head>.
* Always include the final page as a hidden html element, so that it can
  be unhidden with custom CSS.
* Make it easier to change the pagination window.
2021-02-18 02:47:21 -06:00
evazion
075cb73774 Merge pull request #4724 from nonamethanks/underused-cosplay
Don't mark cosplay/style tags as low post count
2021-02-16 18:13:57 -06:00
evazion
1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00
nonamethanks
182d4e1927 Don't mark cosplay/style tags as low post count 2021-02-15 20:05:51 +01:00
evazion
70ab7c50e6 Fix #4703: Report notice for forum posts is visible to non-moderators. 2021-02-06 15:04:27 -06:00
evazion
1eb094c862 tag lists: fix broken '?' links for artist tags. 2021-02-05 20:22:55 -06:00
evazion
7dbf3c53ab related tags: fix missing backgrounds for selected tags. 2021-02-05 19:38:36 -06:00
evazion
1f637867a4 tags: refactor tag lists to use ViewComponent. 2021-02-05 02:37:02 -06:00
evazion
c0f27d6e3b posts: refactor next/prev keyboard shortcuts.
On the post show page, define the next page / previous page keyboard
shortcuts in html using data-shortcut attributes instead of in
Javascript. This is consistent with how these shortcuts are defined on
the post index page.
2021-01-30 01:16:00 -06:00
evazion
27cac98516 posts: eliminate pool_id, favgroup_id url params.
Replace the `pool_id` and `favgroup_id` url params:

    https://danbooru.donmai.us/posts/123?pool_id=456
    https://danbooru.donmai.us/posts/123?favgroup_id=456

with the `q` param:

    https://danbooru.donmai.us/posts/123?q=pool:456
    https://danbooru.donmai.us/posts/123?q=favgroup:456
2021-01-29 23:01:44 -06:00
evazion
1e778dbbf6 posts: factor out post navbar into component.
* Factor out the post navbar into a component. The post navbar is the
  part of the post containing the current search, the list of pools, and
  the list of favgroups, along with next/prev navigation links.

* Change navbar markup: remove various unused CSS classes/IDs, change
  pools to use same markup as favgroups, replace nested <div>'s with
  flat <ul>/<li> list.

* Use CSS to truncate long searches/pool names/favgroup names if they're
  too wide for the screen (especially on mobile).
2021-01-29 21:46:21 -06:00
evazion
d0c9f6e0b8 posts: allow toggling between upvotes and downvotes.
Like 9efb374ae, allow users to toggle between upvoting and downvoting a
post without raising an error or having to manually remove the vote
first. If you upvote a post, then downvote it, the upvote is
automatically removed and replaced by the downvote.

Other changes:

* Tagging a post with `upvote:self` or `downvote:self` is now silently
  ignored when the user doesn't have permission to vote, instead of
  raising an error.
* Undoing a vote that doesn't exist now does nothing instead of
  returning an error. This can happen if you open the same post in two
  tabs, undo the vote in tab 1, then try to undo the vote again in tab 2.

Changes to the /post_votes API:

* `POST /post_votes` and `DELETE /post_votes` now return a post vote
  instead of a post.
* The `score` param in `POST /post_votes` is now 1 or -1, not `up` or
  `down`.
2021-01-29 02:22:23 -06:00
evazion
ffdd5e6128 posts: make post votes work the same way as comment votes.
Change post votes to work the same way as comment votes:

* Make the upvote arrow blue if you've upvoted the post, or grey if you
  haven't. Likewise for the downvote arrow.
* Make it so you can click the upvote or downvote arrows to undo the vote.
* Don't show any notices when you vote on a post.

Also fix it so that votes work the same way on the posts page, the
comments page, and in the modqueue. Before it wasn't possible to undo
votes on the comments page or in the modqueue.
2021-01-29 02:21:08 -06:00
evazion
b6e06ee6fc Fix #4676: Series pool shown as blue unless hovered.
Broken in 49bc2364 by the use of @extend.

Here's what happened. There are two CSS rules that both apply to pool links:

* a:link { color: var(--link-color); }
* .pool-category-series a { color: var(--series-pool-color); }

These rules have equal specificity (0-1-1). This means the rule that is
defined last takes priority. This means the order in which CSS files are
included matters. 49bc2364 used the @extend directive in a rule for
popup menus, which required an @import, which changed the order of the
CSS files, which made the a:link rule suddenly take priority over the
series pool rule.

The proper fix would be to use Sass's new @use directive instead of
@import, but that requires the latest version of Sass, which requires
the latest version of Webpacker, which we can't upgrade to yet because
of breaking changes.

The real moral of the story is: our CSS is very fragile because of
specificity rules. It's very important that rules are defined in a
certain order, otherwise our CSS will break.

* https://sass-lang.com/documentation/at-rules/use
* https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
2021-01-23 16:01:08 -06:00
evazion
5061b0a013 comments: change 'Shortlink' to 'Copy ID'. 2021-01-23 14:34:53 -06:00
evazion
5fd33ad545 posts: fix favorite icon.
Fix the favorite button using the outlined heart icon instead of the
solid heart icon.
2021-01-23 14:33:45 -06:00
evazion
7629a99030 Fix #4675: Comment tooltip doesn't show properly on phone.
Possible fix for #4675. This is still wonky; tapping the menu icon now
opens the menu, but doesn't close it. You have to tap outside the menu
to hide it.
2021-01-23 01:16:46 -06:00
evazion
2eecf4d695 comments: let mods click score to see votes. 2021-01-22 04:26:55 -06:00
evazion
bed5fdafb8 comments: add dtext shortlink option to comment menu.
Add a Shortlink menu option to the comment menu. Clicking this will copy
a DText comment shortlink (e.g. `comment #12345`) to the clipboard. You
can middle-click or right-click the menu option to get the full URL.

The menu option is called Shortlink instead of `comment #1234` because
show the full comment ID in the menu makes the menu look too unbalanced.

Note that the `navigator.clipboard` API can only be used in a https://
environment. It won't work in non-HTTPS development environments. ngrok
can help with this.
2021-01-22 03:55:48 -06:00
evazion
2beac62fc3 comments: move Javascript into component.
This is a minor breaking changing for userscripts that may have tried to
hook into our comment Javascript.
2021-01-21 20:08:14 -06:00
evazion
c718667d46 comments: remove unused <a name="comment-#{id}"> element. 2021-01-21 15:41:26 -06:00
evazion
25bf78f9eb comments: fix incorrect comment links in mentions.
Fix mentions incorrectly linking to comments like this:

    https://danbooru.donmai.us/posts/1234#comment-5678

when it should have been this

    https://danbooru.donmai.us/posts/1234#comment_5678

Change comment links to this to ensure they're permanent:

    https://danbooru.donmai.us/comments/5678

The comment show action will redirect from there to the post with the
comment in context.
2021-01-21 15:36:49 -06:00
evazion
49bc2364bd comments: tweak styling of vote buttons.
* Tweak hover colors for vote buttons.
* Tweak sizes to avoid the vote buttons shifting when the score changes.
2021-01-21 07:58:50 -06:00
evazion
f4216b323f views: change upvote/downvote icons to arrows.
Change the upvote and downvote icons for posts, comments, and BURs from
thumbs-up / thumbs-down icons to up-arrow / down-arrow icons.
2021-01-21 07:58:50 -06:00
evazion
63e3b4b447 views: factor out FontAwesome icons.
Factor out FontAwesome icons into a set of helpers. This is so that it's
easier to keep track of which icons we're using and easier to change
icons globally.
2021-01-21 07:58:50 -06:00
evazion
748fcdddcf forum: fixup forum vote layout issue.
Fix problem with forum votes being laid out in a vertical list instead
of a horizontal list. Broken in 5780ed57.
2021-01-21 07:58:50 -06:00
evazion
9efb374ae5 comments: allow swapping votes.
Allow users to upvote a comment, then downvote it, without raising an
error or having to manually remove the upvote first. The upvote is
automatically removed and replaced by the downvote.

Changes to the /comment_votes API:

* `POST /comment_votes` and `DELETE /comment_votes` now return a comment
  vote instead of a comment.
* The `score` param in `POST /comment_votes` is now 1 or -1, not
  `up` or `down.`
2021-01-21 07:58:50 -06:00
evazion
5780ed5768 comments: add scores, rework comment menu.
* Add comment scores.
* Rework voting buttons so that you can click the upvote/downvote
  buttons to toggle votes.
* Hide the edit, delete, undelete, and report buttons behind a popup menu.
* Show the upvote/downvote/reply buttons to logged out users. Redirect
  them to the login page instead.
2021-01-20 04:41:21 -06:00
evazion
ccae422961 Factor out popup menu component.
Factor out the popup menu inside user tooltips into a reusable
component.
2021-01-19 20:22:41 -06:00
evazion
027359a2c1 comments: fix modreport notices being visible to Members.
Fix the "This comment has been reported" notice being visible for
Members.
2021-01-19 06:05:51 -06:00
evazion
9af407c94b comments: set default comment threshold to -8.
* Set the default comment threshold to -8. This means that comments are
  hidden at -8 or lower and greyed out at -4 or lower.

* Reset the comment threshold to -8 for anyone with a threshold greater
  than -8. For reference, only about ~3100 users had a non-default
  threshold. About 1600 of those had their threshold reset to -8.

* Change the comment threshold to a less-than-or-equal comparison
  instead of a less-than comparsion. This means that a threshold of 0
  before is the same as a threshold of -1 now. Since everyone's
  thresholds were reset, this only affects people whose thresholds were
  already less than -8, which is so low that the difference shouldn't
  matter much.

* Set the maximum comment threshold to 5. For reference, less than 1% of
  comments have a score greater than 5.

* Set the minimum comment threshold to -100. For reference, the most
  downvoted comment has a score of -60.
2021-01-19 05:48:25 -06:00