Commit Graph
100 Commits
Author SHA1 Message Date
evazion bc34fb16a4 tags: automatically fix incorrect tag counts during maintenance.
* Automatically fix all tags with incorrect counts during daily
  maintenance (previously only tags with negative counts were fixed).
* Log fixed tags to NewRelic.
* Remove the ability to manually fix tag counts with the "Fix" button on
  the /tags listing. This is no longer necessary now that tags are
  fixed automatically.
2019-09-25 17:57:11 -05:00
evazion 03d9b3feca pixiv: support new https://www.pixiv.net/artworks/:id urls. 2019-09-24 03:33:21 -05:00
evazion e96d3cba78 autocomplete: fix autocomplete triggering after blank space. 2019-09-23 22:30:56 -05:00
evazion 51e4edadb1 Fix upgrade notice conditional (fixup e98db8a). 2019-09-23 19:22:00 -05:00
evazion 77d2260576 css: clean up <ul> css.
* Remove `list-style-type: none` rules (this is the default).
* Add `list-bulleted` and `list-inline` utility classes.
* Wrap terms of service and user deletion pages in dtext `.prose` class
  so we don't have to redefine basic list styles on these pages.
2019-09-23 19:10:40 -05:00
evazion f4512576a4 css: standardize width of fixed width pages.
Standardize various width-limited pages to 70em width.
2019-09-23 17:56:50 -05:00
evazion 0a6661d145 uploads: switch to active job.
* Switch upload processing from DelayedJob to ActiveJob.
* Remove remaining references to delayed job from tests.

Closes #4128.
2019-09-23 15:11:18 -05:00
evazion 8de6925807 Fix raw sql deprecation warning in tag autocomplete.
DEPRECATION WARNING: Dangerous query method (method whose arguments
    are used as raw SQL) called with non-attribute argument(s): "trunc(3
    * similarity(name, 'two')) DESC". Non-attribute arguments will be
    disallowed in Rails 6.1. This method should not be called with
    user-provided values, such as request parameters or model
    attributes. Known-safe values can be passed by wrapping them in
    Arel.sql(). (called from order_similarity at
    /home/admin/src/danbooru/app/models/tag.rb:817)
2019-09-23 13:52:21 -05:00
evazion c1bb88a52a tests: fix mock_saved_search_service! calls (fixup 4e4c4d627) 2019-09-23 03:22:32 -05:00
evazion 05e754eba3 users: change default user level to member in database.
Fixup for 9c34d5cc3. Default to member level in the database because
setting it in `customize_new_user` clobbered user levels set by factory
bot in tests, which broke the test suite.
2019-09-23 02:22:54 -05:00
evazion 09972477cd users: fix find_by_name for names with special characters.
`User.find_by_name` used `where_ilike` to do a case-insensitve name
search, but it didn't escape `*` or `\` characters first, so it didn't
handle names containing these characters properly.
2019-09-23 00:03:11 -05:00
evazion dcc2c793f9 Update gems. 2019-09-22 23:44:21 -05:00
evazion a164951b54 saved searches: add more order options (#4171). 2019-09-22 23:38:48 -05:00
evazion a5949a4b28 saved searches: always show 'Saved searches' link in navbar.
* Always display 'Saved searches' link in subnav bar, even if the user
  hasn't created any saved searches yet.
* Eliminate use of `has_saved_searches` bitpref on users.
2019-09-22 23:14:55 -05:00
evazion 4e4c4d627e saved searches: remove option to disable saved searches.
Remove `SavedSearch.enabled?` checks. There's no need to make saved
searches optional, since Redis is now required to run Danbooru.
2019-09-22 23:04:22 -05:00
evazion c33c33500e notes: fix embedded note text color in dark mode. 2019-09-22 22:59:33 -05:00
evazion cdb1c5c5ae uploads: fix drag and drop to work anywhere on page. 2019-09-22 22:59:33 -05:00
evazion bf3e9e1c76 uploads: show thumbnails in dropzone widget. 2019-09-22 22:59:33 -05:00
evazion 94d2bc72f2 uploads: move dropzone code to uploads.js. 2019-09-22 22:59:33 -05:00
evazion 5a7b3d812e uploads: fix dropzone widget to allow replacing files. 2019-09-22 22:59:33 -05:00
evazion 22d4625071 Fix #4173: Fix inconsistent max upload size. 2019-09-22 22:59:33 -05:00
evazion 1d6d816b23 nginx: add production nginx config files. 2019-09-22 22:59:33 -05:00
evazion e1cdcbd4ce uploads: add max filesize to upload page.
Fixes #4172.
2019-09-22 22:59:15 -05:00
evazion 79c22b8d50 Fix #4174: Don't allow invalid prefix combinations for autocomplete.
* Autocorrect duplicated operators (e.g. complete `--tag` as `-tag`).
* Don't accept invalid metatag + prefix combinations (e.g. don't
  complete `char:rating:s` as `rating:safe`).
2019-09-22 18:58:12 -05:00
evazion 9839f97f9e Fix #4176: Ordering favorite groups errors out. 2019-09-22 15:24:23 -05:00
evazion e98db8a5b8 css: refactor notice box css.
* Remove .ui-corner-all, .ui-state-highlight, .ui-state-error classes
  from notice boxes.
* Use .notice, .notice-info, .notice-error classes instead.
* Replace <p> elements in notices with <div>'s so that we don't have to
  work around the `margin-bottom: 1em` from <p> elements.
* Replace <h1> elements in notices with <h2>.
* Standardize info notices to use the same shade of light yellow in the
  light theme.
2019-09-22 15:09:45 -05:00
evazion 6b2e6fa3f4 css: fix width of #tags input in search box.
Fix the #tags input not shrinking to fit inside the sidebar.

https://github.com/r888888888/danbooru/commit/9720e4cfa9a02bb0d412183709f70541b2653bef#r35160195
2019-09-22 02:58:09 -05:00
evazion 8f6fd95e2d posts: change "»" links next to sources in sidebar.
* On the posts show page, make the "»" link next to the source visible
  to all users, not just builders.
* Make "»" link to the raw unnormalized source, instead of a `source:` search.
* Remove the special case for displaying old pixiv sources as `pixiv/moniker`.
2019-09-22 02:58:09 -05:00
evazion 5f43401b7b Fix #4175: Twitter no longer redirects tweet links for non-existent handles. 2019-09-22 02:58:09 -05:00
evazion 14077502a9 css: tweak dark mode colors. 2019-09-22 02:58:09 -05:00
evazion 0a08f9ea9b css: rework dark mode color palette.
* Switch from flat greys to cool blue greys.
* Define colors with HSLuv (https://www.hsluv.org) so that each band of
  colors is perceptually uniform (has the same brightness and contrast).
2019-09-22 02:58:09 -05:00
evazion d15b29c0cc users: include current theme in /profile.json. 2019-09-19 15:57:53 -05:00
evazion 56c7727dd2 css: fix margin between commentary box and search navbar on posts.
* Fix commentary box not having a gap between it and the search navbar
  when the search navbar is beneath the post (the default setting).
* Reduce border radius of commentary box.
2019-09-19 15:01:05 -05:00
evazion 9720e4cfa9 css: fix positioning of search button in tag search box.
Fixes the search button wrapping to the next line in Firefox. Also fixes
the search box to be full width with no gap between the search box and
the search button.
2019-09-19 14:20:47 -05:00
evazion bf51d68f15 users: add dark mode account setting (fix #4158). 2019-09-19 13:20:06 -05:00
evazion ca4cba7635 views: remove tag size indicator bars from /tags.
Remove tag size indicator bars. These bars don't play nicely with dark
mode and aren't all that useful to begin with.
2019-09-19 12:57:56 -05:00
evazion 828b225dac css: tweak dark mode styles.
* Adjust platinum user color.
* Change alert notices to grey with blue border.
* Add padding to text <input> elements so that the text isn't right next
  to the edge.
2019-09-19 12:57:56 -05:00
evazion 81f862a498 css: add dark mode stylesheet (#4158). 2019-09-19 04:33:08 -05:00
evazion c86a24743a css: add more variables for dark mode.
Add some more variables that will be needed for dark mode.
2019-09-19 04:26:47 -05:00
evazion e15c5ad217 css: remove unused search box css. 2019-09-19 03:16:49 -05:00
evazion 72e20f14d4 css: remove unused dmail preview css. 2019-09-19 02:54:53 -05:00
evazion dacd5b0fc6 views: simplify timestamp styling on wiki page versions. 2019-09-19 02:40:51 -05:00
evazion ee1a6fa96f css: add <input> placeholder & quick search form styling. 2019-09-19 02:25:45 -05:00
evazion 9359797a00 css: refactor <button> and <input> element styling.
* Style <button> and <input> elements explicitly instead of relying on browser defaults.
* Style jquery ui buttons the same way as regular buttons.
* Add color variables so we can restyle form inputs in dark mode.
2019-09-19 02:18:23 -05:00
evazion 162ca0782a css: fix swapped parent/child notice backgrounds. 2019-09-18 03:40:11 -05:00
evazion b24ce0922a css: fix spacing in flag/appeal notices. 2019-09-18 03:30:57 -05:00
evazion 312adb772d views: refactor post flag and appeal reasons.
* Prefer partials over helpers.
* Add css classes to flag/appeal reason lists.
* Wrap dtext in span.prose container.
2019-09-18 03:20:26 -05:00
evazion 49f91a6100 css: fix missing [tn][/tn] dtext styles. 2019-09-17 18:44:23 -05:00
evazion 9c34d5cc39 users: fix default user level in test env.
Bug: in the test environment, new users defaulted to the Anonymous level
instead of the Member level. This broke signing up as a new user with
Capybara during system tests.
2019-09-17 18:15:36 -05:00
evazion 02354e83fe tests: add autocomplete system tests. 2019-09-17 18:14:33 -05:00
evazion 4dfa645550 Fix #4169: Tag operators not working with autocomplete. 2019-09-17 13:48:09 -05:00
evazion 0bb25e094a tag change request pruner: fixup for e3ae87cff. 2019-09-17 02:43:53 -05:00
evazion c2a76840c9 tags: allow hovering over tag counts in sidebar to see exact counts. 2019-09-17 02:06:42 -05:00
evazion 3b831b8b50 css: fix member user color. 2019-09-17 01:56:30 -05:00
evazion e3ae87cff7 Fix #4168: Ignore validations when rejecting tag changes.
* Only check for conflicts with existing aliases/implications when
  requests are created or approved, not when requests are rejected.

* Use `update!(status: "deleted")` instead of `update(status: "deleted")`
  so that if rejecting the request fails we fail immediately instead of
  continuing on and updating the forum topic.

* Wrap `reject!` and `TagChangeRequestPruner.reject_expired` in
  transactions so that if updating either the request or the forum
  fails, they both get rolled back.
2019-09-17 01:30:28 -05:00
evazion 6013b00fee Update gems. 2019-09-17 00:28:41 -05:00
evazion 7461372e07 css: standardize body text colors.
* Standardize on one shade of grey for all grey text.
* Use very dark grey instead of black for body text.
2019-09-17 00:28:41 -05:00
evazion 9c96557be8 css: standardize post notice css.
* Standardize post notice background colors.
* Replace .ui-state-highlight and .ui-corner-all classes with .post-notice.
* Rename post notice classes (e.g. .notice-parent -> .post-notice-parent).
* Remove hover effect from sequential search navbar.
2019-09-17 00:28:41 -05:00
evazion e91e68c206 css: fix autocomplete colors. 2019-09-17 00:28:41 -05:00
evazion 4842728ed7 css: remove borders from around iqdb thumbnails. 2019-09-17 00:28:41 -05:00
evazion c2bfd2ebe6 css: make forum post borders mobile-only.
* Remove box shadows around forum posts.
* Make borders around forum posts mobile only.
2019-09-17 00:28:41 -05:00
evazion 852c1cbb7c css: clean up file upload widget css.
* Standardize the upload widget background colors (light green for success,
  light red for error).
* Move the progress bar to the bottom of the upload widget.
* Change the progress bar color to blue.
* Hide the "drag and drop a file here" message after a file has
  already been uploaded.
2019-09-17 00:28:41 -05:00
evazion e3406d1bc7 css: standardize success/error background colors.
Standardize background colors to light green or light red in several places:

* Modqueue positive/negative score backgrounds.
* Modqueue quality/sample warning backgrounds.
* User feedback positive/negative backgrounds.
* Ban expired/unexpired backgrounds.
* Flag resolved/unresolved backgrounds (removed; resolved flags no
  longer have a grey background because of inconsistencies in what
  resolved means).
2019-09-17 00:28:41 -05:00
evazion 31ebfa0a82 css: standardize styling of fineprint text.
Fineprint text was variously styled with `.info`, `.tn`, `.hint`, or
`.cost-footnote` css classes. Standardize on `.fineprint` instead. Use
`.hint` only for form hints and `.tn` only for <tn> tags in translation
notes.

Incidentally changes the font size of form hints to 0.8em (was 0.7em)
and the color of fineprint to #888 (was #AAA or #666).
2019-09-17 00:28:41 -05:00
evazion c325bfa199 css: factor out colors from main css (#4158). 2019-09-17 00:28:41 -05:00
evazion d203a543d0 css: remove 5px margin above page header.
The "Danbooru" link in the header had a 5px top margin, which created a
small gap above the page that caused mode menu backgrounds to show
through in an ugly way.
2019-09-17 00:28:41 -05:00
evazion 335fc2e872 css: fix blockquote margins in tables.
Don't remove the bottom margin from all <p> elements in tables. Instead
remove it only from the last element in dtext blocks. This way we don't
have to also kludge <blockquote> padding to work with zero-margin paragraphs.

Better fix for #1655.
2019-09-17 00:28:41 -05:00
evazion 73a4d675c0 css: ensure dtext is always wrapped in .prose container.
Ensure dtext is always wrapped in a `<div class="prose">` or
`<span class="prose">` (for inline dtext) container so that dtext css is
properly applied.
2019-09-17 00:28:41 -05:00
evazion a5ef86bbe8 views: add html ids for main menu and subnav menu.
Also refactor secondary links to put the <menu> element in the default
layout instead of in each _secondary_links partial.
2019-09-17 00:28:41 -05:00
evazion c85bbbf8c2 comments: fixup "show hidden comments" link.
Fixup for 896f144eb.
2019-09-17 00:28:40 -05:00
evazion 793c07341d Fix #4163: Remove reversion links outside of the proper context. 2019-09-12 22:37:32 -05:00
evazion f8dd3eb72b Fix #4165: Add mechanism to test error responses.
https://danbooru.donmai.us/posts.json?error=500&message=testing
2019-09-12 22:37:32 -05:00
evazion 4915690c6d Fix #4166: Some metatags incorrectly showing tag results. 2019-09-12 22:37:32 -05:00
evazion 637e961f0a Fix #4167: Add more IDs to side menu elements. 2019-09-11 03:19:49 -05:00
evazion a5043245b6 views: migrate related tags, mass edits to simple form. 2019-09-10 21:51:14 -05:00
evazion 896f144eb6 views: refactor quick search forms. 2019-09-10 21:10:09 -05:00
evazion ffccc503f7 views: removed unused helpers. 2019-09-10 15:21:48 -05:00
evazion 372fd7df1b /pool_versions: fix exception in pool diffs.
https://danbooru.donmai.us/forum_topics/9127?page=280#forum_post_159633
2019-09-10 15:13:06 -05:00
evazion e815f46d2a /meta_searches/tags: fix tag_alias_correction_path reference.
Tag alias corrections were removed in #4130. Fixes exception on /meta_searches/tags.
2019-09-10 14:59:27 -05:00
evazion a1b48f5e3f views: migrate search forms to use simple form.
Migrate various forms to be built using simple form instead of raw html.
Also adds autocomplete="off" to these forms (#4162).
2019-09-10 14:33:18 -05:00
evazion 1743f3797f views: factor out search_form_for helper.
Refactor search forms to use `search_form_for` so that we can set common
options on all search forms, such as autocomplete="off" (#4162).
2019-09-10 14:31:19 -05:00
evazion 49d38d6256 views: fix positioning of form hints.
Position <span class="hint"> elements to the right of normal <input>
elements and underneath <textarea> elements. Fixes form hints being
badly positioned on some pages.
2019-09-10 14:30:49 -05:00
evazion 347aa4b835 Add error pages for tag limit and pagination errors. 2019-09-09 17:43:30 -05:00
evazion 62b89e1f9a user upgrades: make upgrade page visible to logged out users. 2019-09-09 17:42:46 -05:00
evazion 93256c3ab2 Fix broken TagSubscription migration.
Disable old migration because TagSubscription model no longer exists
(should have been a fix script instead of a migration).
2019-09-09 17:03:28 -05:00
evazion 059e061b15 tests: fixup comment vote, post controller tests.
Use git clean to delete stale files from an earlier checkout. These
files interfered with various things (specifically, a comment vote test
failed because there was an old comment_votes/create.json.erb template
hanging around that changed the behavior of the POST /comment_votes endpoint).
2019-09-09 15:06:24 -05:00
evazion d812a19902 tests: fixup tests. 2019-09-09 11:51:01 -05:00
evazion efca48ee96 Set SameSite=Lax on session cookies.
https://web.dev/samesite-cookies-explained
2019-09-09 11:51:01 -05:00
evazion 312606bf98 Fix #4137: Share cookies across subdomains 2019-09-09 11:51:01 -05:00
evazion 6595a9f87e users: raise max posts per page to 200. 2019-09-08 23:34:49 -05:00
evazion 8198c610cc /pool_versions: add '»' drilldown links.
Add '»' drilldown links for pool names, users, and post ids.
2019-09-08 23:28:02 -05:00
evazion 964a073ec3 Fix #4159: Add pool history to post show pages. 2019-09-08 23:28:02 -05:00
evazion b202985eaa posts/show: make post history pages visible to all. 2019-09-08 23:28:02 -05:00
evazion 5729d92c8e posts/show: make 'download', 'find similar' links visible to all. 2019-09-08 23:28:02 -05:00
evazion 763ac1a7e0 pools: stop maintaining pool category pseudotags in pool strings (#4160)
Stop maintaining pool category pseudo tags (pool:series, pool:collection)
in pool strings. They're no longer used and the changes to the
`Post#pools` method in dc4d2e54b caused issues with this.

Also allow Members to change the category of large pools again. This was
only restricted because maintaining these pseudotags forced us to update
every post in the pool whenever a pool's category was changed.
2019-09-08 23:28:02 -05:00
evazion d0f060d8eb api: refactor api attribute declarations.
Replace the `method_attributes` and `hidden_attributes` methods with
`api_attributes`. `api_attributes` can be used as a class macro:

    # include only the given attributes.
    api_attributes :id, :created_at, :creator_name, ...

    # include all default attributes plus the `creator_name` method.
    api_attributes including: [:creator_name]

or as an instance method:

    def api_attributes
       [:id, :created_at, :creator_name, ...]
    end

By default, all attributes are included except for IP addresses and
tsvector columns.
2019-09-08 23:28:02 -05:00
evazion 19f2cc1e74 api: refactor only param. 2019-09-08 23:28:02 -05:00
evazion 24202d51f0 api: support the expires_in param on all GET requests.
`expires_in` is an alternative to `expiry` that supports durations other
than days:

* https://danbooru.donmai.us/posts.json?expires_in=30s
* https://danbooru.donmai.us/posts.json?expires_in=5min
* https://danbooru.donmai.us/posts.json?expires_in=1hour
* https://danbooru.donmai.us/posts.json?expires_in=1week
* https://danbooru.donmai.us/posts.json?expires_in=1month
2019-09-08 15:32:31 -05:00
evazion 22fd90eee9 api: support the expiry param on all GET requests. 2019-09-08 15:32:31 -05:00
evazion 3f7e05316d api: refactor default options for xml responses.
In xml responses, if the result is an empty array we want the response
to look like this:

   <posts type="array"/>

not like this (the default):

   <nil-classes type="array"/>

This refactors controllers so that this is done automatically instead of
having to manually call `@things.to_xml(root: "things")` everywhere. We
do this by overriding the behavior of `respond_with` in `ApplicationResponder`
to set the `root` option by default in xml responses.
2019-09-08 15:32:31 -05:00