Commit Graph

661 Commits

Author SHA1 Message Date
evazion
2eeee446a5 js: upgrade to MobX 6.0. 2021-01-27 17:46:17 -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
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
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
c31f2003d9 dtext: change [quote] styling.
Change [quote] styling to Reddit/Github style (greyed out, with a bar on
the left side) instead of traditional forum style (big grey box around
the quote).

Reasons for this change:

* Box style is bulkier, especially for short quotes in comments.
* Box style works poorly for deeply nested quotes.
* Box style looks bad on widescreen monitors, since the quote stretches
  across the full width of the screen.
2021-01-20 04:41:21 -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
07bdc6eab0 comments: rework thresholded comments.
Previously thresholded comments were hidden completely. You had to click
the "Show X hidden comments" button to unhide all hidden comments in a
thread. Now it works like this:

* When a comment is below your threshold, the comment text is hidden and
  replaced by a `[hidden]` link, which you can click to unhide the comment.

* When a comment is at half your threshold (for example, your threshold
  is -8 but the comment is at -4), then the comment is greyed out.

This means that comments aren't completely hidden, they're just
collapsed, so you can see the commenter and the score without unhiding
the comment. It also means you don't have to scroll back up to unhide a
comment, and threads aren't disrupted by comments being secretly
hidden (which is confusing when people are replying to hidden comments,
which forces you to go back up and unhide to find).
2021-01-19 04:07:33 -06:00
BrokenEagle
180eebb77a Don't normalize on the nudge event
The normalization always ends up being less than a pixels difference,
and the clamp applied later on removes that difference. Before the
clamp was added, it had the effect of moving the box along it's angle
of rotation. Now it moves it along the x,y axis of the image itself,
which is probably more intuitive anyways.

It's still needed for the drag and drop though, otherwise, it displaces
by a certain amount making it impossible to accurately place.
2021-01-16 22:20:51 +00:00
evazion
e7cdae33b2 modreports: remove dead code. 2021-01-16 01:34:38 -06:00
evazion
b4530183f4 Fix #4525: Show mod report notices next to reported content. 2021-01-16 01:02:42 -06:00
evazion
37792bd5dd forum posts: refactor to use ViewComponent. 2021-01-16 01:02:42 -06:00
evazion
724d87f68a comments: refactor to use ViewComponent. 2021-01-16 01:02:42 -06:00
evazion
d408ccbd41 users: remove option to disable autocomplete.
This option was originally added in issue #1747. But only ~350 users
ever disabled autocomplete, only ~120 of these were seen in the last
year, and only 9 new users who signed up in the last year disabled it.

Users wishing to disable autocomplete can use this CSS:

    .ui-autocomplete { display: none !important: }

or this Javascript:

    $("[data-autocomplete]").autocomplete("disable");
2021-01-15 02:03:54 -06:00
evazion
99d447279b users: remove option to disable keyboard shortcuts.
Remove the enable_post_navigation option. This option was originally
added to disable the next/prev post navbar beneath posts. It was later
repurposed to disable keyboard shortcuts.

Users who don't want keyboard shortcuts are advised to not press random
buttons on the keyboard like a caveman.

Only ~1200 users disabled this option and only ~600 were seen in the
last year.
2021-01-15 02:03:54 -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
a698ca2b8c Fix #4663: Tag script mode sometimes adds "null" tag. 2021-01-11 19:27:10 -06:00
evazion
94e125709c users: add Restricted user level.
Add a Restricted user level. Restricted users are level 10, below
Members. New users start out as Restricted if they sign up from a proxy
or an IP recently used by another user.

Restricted users can't update or edit any public content on the site
until they verify their email address, at which point they're promoted
to Member. Restricted users are only allowed to do personal actions
like keep favorites, keep favgroups and saved searches, mark dmails as
read or deleted, or mark forum posts as read.

The restricted state already existed before, the only change here is
that now it's an actual user level instead of a hidden state. Before it
was based on two hidden flags on the user, the `requires_verification`
flag (set when a user signs up from a proxy, etc), and the `is_verified`
flag (set after the user verifies their email). Making it a user level
means that now the Restricted status will be shown publicly.

Introducing a new level below Member means that we have to change every
`is_member?` check to `!is_anonymous` for every place where we used
`is_member?` to check that the current user is logged in.
2021-01-07 17:10:29 -06:00
evazion
e6f2bf1c89 autocomplete: tweak css. 2021-01-04 04:13:36 -06:00
evazion
d24275c51c Merge pull request #4622 from BrokenEagle/add-childlike-font
Add childlike font
2021-01-04 01:29:25 -06:00
evazion
6793aedf81 Fix #4650: Differentiate between aliases and corrections in autocomplete.
Display a red wavy underline beneath misspelled tags in autocomplete.

We use an inline image for the underline instead of the native
`text-decoration: red wavy underline` property because the native
underline is too big and ugly, and we have no way to adjust it. Making a
nice-looking wavy underline in CSS is surprisingly difficult. This
turned out to be the cleanest way.
2021-01-04 00:25:47 -06:00
evazion
1d15ce2bcd Remove Danbooru Winter Sale. 2021-01-01 04:16:38 -06:00
evazion
83d6cd5980 Update Winter Sale banner for last day. 2020-12-31 06:50:10 -06:00
evazion
d9a8fc99bc javascript: change Cookie.put to take expiry in seconds. 2020-12-31 06:50:10 -06:00
evazion
fd18291382 Add Danbooru Winter Sale. 2020-12-25 06:07:21 -06:00
evazion
069231a33b user upgrades: update upgrade landing page.
* Add a frequently asked questions section.
* Add nicer looking upgrade buttons.
* Format the page nicer.
* Prevent users from attempting invalid upgrades on users that are
  already Platinum or above.
2020-12-25 00:47:08 -06:00
evazion
3d1ff9dff9 autocomplete: fix not detecting correct tag in edit box. 2020-12-17 23:57:13 -06:00
evazion
0d83106a21 autocomplete: fix cache issue related to content negotiation.
This is the scenario:

* You type something in autocomplete, let's say 'touhou'.
* Autocomplete calls /autocomplete?search[query]=touhou&search[type]=tag_query
* The endpoint returns JSON, because the autocomplete call sets an
  `Accept: application/json` header requesting JSON.
* Visit /autocomplete?search[query]=touhou&search[type]=tag_query in your browser.
* Notice that the cached JSON response is incorrectly returned, not an
  HTML response like the browser requested.

The problem is that the response type is chosen based on the Accept
header, but the response didn't set the `Vary: Accept` header, so the
browser doesn't know the response type can vary and so it incorrectly
returns the cached response.

This issue is partially fixed by Rails 6.1 ([1]), which properly sets the
`Vary: Accept` header when the response depends on the Accept header.

However, the next issue is that Cloudflare doesn't respect the Vary
header at all ([2], [3]). Therefore we can't use the Accept header to
pick the format, instead we have explicitly specify the format with
/autocomplete.json.

This is clearer and better for caching anyway. Using the `Vary: Accept`
header reduces the cache hit rate, because the exact format of the
Accept header varies across browsers, which fragments the cache.

Whew.

[1] https://github.com/rails/rails/pull.36213
[2] https://community.cloudflare.com/t/cloudflare-cdn-cache-to-support-http-vary-header/160802
[3] https://support.cloudflare.com/hc/en-us/articles/115003206852
[4] https://www.smashingmagazine.com/2017/11/understanding-vary-header/
2020-12-16 03:13:55 -06:00
evazion
4cdaf7bcdf autocomplete: update html data attributes.
* Remove the `source` and `weight` html data attributes (no longer used).
* Make the `type` html data attribute properly indicate the completion
  type. Valid types: `tag`, `tag-alias`, `tag-abbreviation`,
  `tag-autocorrect`, `tag-other-name`.
2020-12-14 18:58:11 -06:00
evazion
23f6b8a46d js: refactor Cookie.put.
* Set Max-Age= flag instead of Expires= flag.
* Set Secure flag when using HTTPS.
* Extend default cookie lifetime from 1 year to 20 years.
* Remove "session" expiration option (unused).
* Remove max cookie size check.

The cookie size check was previously added in #2518 to deal with running
out of space due to tag scripts and blacklists. This should no longer
happen since we no longer use cookies for these things. Remove the
warning because it should never happen, we can't fix it if it does, and
the user probably won't know how to fix it either.
2020-12-14 15:39:17 -06:00
evazion
df1404b673 js: set SameSite=Lax on cookies set by Javascript.
This is the new default for most browsers nowadays. Fixes a warning in
Firefox about using SameSite=None without the Secure flag.
2020-12-14 15:37:58 -06:00
evazion
0150911343 css: remove missing --dtext-expand-border-color var. 2020-12-14 14:29:31 -06:00
evazion
67eefadd7f users: let mods see email addresses on user profiles.
* Let Mods and Admins see the email addresses of users below their level.
* Let users see their own email address on their profile.
* Let users verify or edit their email address from their profile.

This is to make catching sockpuppets easier, and to make it easier for
users to fix their email.
2020-12-13 21:21:08 -06:00
evazion
b3ad13e6e3 users: add new owner level.
Add a new Owner user level for the site owner. Highly sensitive
operations like manually changing the passwords of other users will be
restricted to the site owner.
2020-12-13 21:18:24 -06:00
evazion
b002bf25f5 autocomplete: display autocorrected tags like aliases.
Display autocorrected tags similar to aliases, with an arrow pointing at
the corrected tag, but with a dotted underline beneath the misspelled
tag to indicate that it's misspelled.
2020-12-13 04:10:48 -06:00
evazion
adc1c2c2cc autocomplete: refactor javascript to use /autocomplete endpoint.
This refactors the autocomplete Javascript to use a single dedicated
/autocomplete.json endpoint instead of a bunch of separate endpoints.

This simplifies the autocomplete Javascript by making it so that instead
of calling a different endpoint for each type of query (for users, wiki
pages, pools, artists, etc), then having to parse the results of each
call to get the data we need, we can call a single endpoint that returns
exactly what we need.

This also means we don't have to parse searches clientside in order to
autocomplete metatags. Instead we can just pass the search term to the
server and let it parse the search, which is easy to do serverside.

Finally, this makes autocomplete easier to test, and it makes it easier
to add more sophisticated autocomplete behavior, since most of the logic
lives serverside.
2020-12-13 00:45:22 -06:00
BrokenEagle
2ae912a8be Add childlike font 2020-11-14 18:00:08 +00:00
Aaron Franke
191b528ad7 Ensure files end in newlines (POSIX compliance) 2020-10-04 05:13:39 -04:00
evazion
c295e233f2 Fix #4597: <code> blocks no longer render as monospace for notes. 2020-08-21 21:14:42 -05:00
evazion
fee68b6dd9 css: fix input box size in inline forms. 2020-08-18 11:08:02 -05:00
evazion
d98dd0bb6d ugoiras: don't initialize notes on ugoiras.
Fixes note font scaling increasing the size of the ugoira playback controls.
2020-08-18 11:06:19 -05:00
evazion
d072ef98ba css: don't use monospace font for textareas.
This changes the font in text input boxes (including the tag edit box)
from monospace to Verdana.
2020-08-16 15:17:40 -05:00
evazion
44cbce9855 css: factor out fonts to css variables. 2020-08-16 15:01:28 -05:00
evazion
317cfe19b4 flags: only show current flag on flagged posts.
* Only show the current pending flag on flagged posts. Don't show old flags.

* Don't show both the "This post was flagged for review" and the "This
  post was flagged and is pending" notices.
2020-08-16 14:31:47 -05:00
evazion
7eb9f0b75e appeals: only show current appeal on appealed posts.
* Only show the current pending appeal in the "This post was appealed"
  notice. Don't show old appeals.

* Don't show both the "This post was deleted" and the "This post was
  appealed" notice on appealed posts. Only show the "This post was
  appealed" notice.

* Show "no reason" if no appeal reason was given.
2020-08-16 14:31:47 -05:00
evazion
06564b25ca autocomplete: add status:appealed to autocomplete. 2020-08-12 22:40:17 -05:00
evazion
3d3b5262cc uploads: don't show translated commentary in tag edit dialog. 2020-08-12 11:02:11 -05:00
evazion
3a17b5a13e flags/appeals: replace is_resolved flag with statuses.
Replace references to the `is_resolved` field with the `status` field.
Post flags were marked as resolved when a post was approved (but not
when the post was deleted because it went unapproved). The status field
supercedes the resolved field.
2020-08-07 19:24:57 -05:00