Commit Graph
100 Commits
Author SHA1 Message Date
evazion ad056e69d5 utility.js: simplify even/odd table row striping. 2018-08-17 16:25:36 -05:00
evazion eef8b9c323 posts/show: fix flash message when faving/unfaving posts.
Bug: if you faved a post, then opened another page in a separate tab,
then the "You have favorited this post" flash message would appear in
the separate tab.

Fixes regression in bcaee199.
2018-08-15 20:14:51 -05:00
evazion ec0646c234 posts/show: don't scroll page when opening edit dialog.
Don't scroll up the page when opening the tag edit dialog via shift+e.
Fixes regression in #3812.
2018-08-15 18:56:52 -05:00
evazion bcaee199f5 favorites: unify create.js.erb & destory.js.erb code paths. 2018-08-12 15:51:18 -05:00
evazion fb91bbc6c5 Fix #3813: Favorite limit can be bypassed. 2018-08-12 14:22:08 -05:00
evazion 202527008f user.rb: drop unused add_favorite!, delete_favorite! methods.
These methods were incorrect anyway, didn't upvote/downvote the post.
2018-08-12 12:35:15 -05:00
evazion bbaadda1e3 Convert keyboard shortcuts to use data-shortcut. 2018-08-12 12:09:58 -05:00
evazion d369d38419 shortcuts.js: Add declarative data-shortcut keyboard shortcuts. 2018-08-11 16:38:21 -05:00
evazion 755397e6c9 comments.js: remove dead code.
Remove dead and hide_threshold_comments and initialize_expand_links
methods. initialize_expand_links is dead because `.comment-section`
doesn't exist.
2018-08-09 14:45:26 -05:00
evazion 130570aa33 comments.js: fix thresholded comments.
* Restore behavior of thresholded comments being greyed out (lost in 6fa0ae2cf).

* Set the `below-threshold` class for thresholded comments in the html instead of in javascript.

* Remove `include_below_threshold` param; it was always true when clicking "Show all comments".
2018-08-09 14:45:26 -05:00
evazion 031cb6b8cf comments.js: use event delegation to bind click handlers.
Use event delegation to bind click handlers so that they don't have to
be rebound when comments are dynamically loaded with "Show all comments".
2018-08-09 14:45:24 -05:00
evazion 8e8a39af43 comments.js: fix forms flickering on page load.
Mark the edit form, new comment form, and unvote links as hidden in
html, instead of showing them by default then hiding them later in
Javascript. This eliminates flickering on page load.
2018-08-09 14:44:20 -05:00
evazion c615b53a7e Fix broken "Link to alias" / "Link to implication" forum links.
/tag_implications was changed to filter out inactive implications by
default when the `status` param wasn't given.

This broke "Link to implication":/tag_implications?search[id]=NNN links
inside pending implication requests in forum posts. These links now
return an empty search instead of the pending implication.

Hiding inactive aliases/implications by default also changed the API behavior.
2018-08-09 12:49:40 -05:00
evazion abe8b9c071 Fix "Show all comments" link.
The second argument to `trigger` is supposed to be an array.

ref: https://danbooru.donmai.us/forum_topics/9127?page=250#forum_post_149379
2018-08-08 23:44:35 -05:00
evazion 107d19c6b3 Tag scripts: drop [if ...] and [reset] syntax (fix #3807, #3773)
Fixes #3807. Drops the TagScript module entirely and replaces it with
a simple call to Post.tag.

Simultaneously fixes #3773 as a consequence of removing TagScript.run.
Post.update already updates data-tags by itself, so there was no need
for TagScript.run to update data-tags as well.
2018-08-08 16:01:42 -05:00
evazion f72b32b27b Fix eslint warnings. 2018-08-05 18:30:25 -05:00
evazion 752557e813 Add eslint support.
Run with `yarn run lint` or `bin/webpack`.
2018-08-05 18:30:25 -05:00
evazion 9ee93a8d1f Utility.keydown(): fix search+replace mistake (#3799). 2018-08-04 18:14:54 -05:00
evazion 5de0bd2ebb cookie.js: remove unused code.
Unused since 65a87941.
2018-08-04 18:14:54 -05:00
evazion 0c5b5e28b5 utility.js: remove unused get_url_parameter function.
Unused since 025d66a6.
2018-08-04 18:14:54 -05:00
evazion 7c524f867b Fix more missing Utility imports (#3791). 2018-08-04 11:37:25 -05:00
evazion 2b33d23168 Fix broken commentary fetch in "Add commentary" dialog (#3791). 2018-08-04 11:31:44 -05:00
evazion 8589d514dc Fix #3799: Fetch source data link is broken 2018-08-04 10:28:14 -05:00
evazion 0b4e114721 Fix #3705: Rename "Flags & Appeals" now that it includes approvals. 2018-05-11 17:28:06 -05:00
evazion 0ac28634f4 Fix #3708: Post approvals sometimes displays multiple approvers for same post 2018-05-11 17:15:51 -05:00
evazion a22bf20230 post tooltips: add header bar with more post info.
Add a header bar containing the following information:

* Uploader + top tagger + upload date
* Score, favorite count, comment count
* Rating
* Source (Pixiv, Twitter, etc)
* Image dimensions

Also list series pools with tags.
2018-05-07 13:18:22 -05:00
evazion 27ca4f7cb1 post tooltips: reduce width/height, increase delay. 2018-05-07 13:18:22 -05:00
evazion e8f5d8d8c2 site map: add approvals index, move post events to own section. 2018-05-05 14:00:58 -05:00
evazion bfecbffb97 post approvals: add to post events page. 2018-05-05 14:00:58 -05:00
evazion 7c1d5e25fb post approvals: add index page + search options (fix #3579). 2018-05-05 14:00:49 -05:00
evazion 181a906766 Fix #3695: Bookmarklet breaks on pixiv fanbox direct image links. 2018-05-05 12:21:11 -05:00
evazion c584ca5b19 Fix uploads getting stuck in 'processing' state (fix #3659).
Bug: if an upload timed out while downloading the file, Upload#process!
would catch the error and attempt to retry, but since the upload was
already in the 'processing' state, on the second try `process!` would
bail out immediately and leave the upload stuck in the 'processing' state.

Fix: remove the retry logic from Upload#process!. Let Downloads::File#download!
(which had its own retry logic) handle it instead.
2018-05-05 11:42:40 -05:00
evazion 0836e4b850 tests: fix upload tests.
Fix some uploads tests that got mixed up when merging abce4d2 (see also d089be9).
2018-05-05 11:20:21 -05:00
evazion 59ab9820b0 tests: fix FactoryGirl reference. 2018-05-03 20:37:23 -05:00
evazion 216d735f24 Fix #3696: API: handle boolean params consistently
* Use ApplicationRecord#attribute_matches to handle boolean attributes
  consistently in search methods.

* Add support for searching various boolean attributes that previously
  weren't supported.
2018-05-03 19:57:14 -05:00
evazion c7492343ce String: add truthy? & falsy? core extensions.
* Add `truthy?` and `falsy?` core extensions to String.

* Use `truthy?` and `falsy?` to replace ad-hoc parsing of boolean
  parameters in various places.
2018-05-03 19:57:14 -05:00
evazion 96669ca4b5 Fix #3694: Favgroup UX issues. 2018-05-03 00:53:42 -05:00
evazion 80f8a7fee4 post tooltips: add disable button inside tooltip. 2018-04-30 02:20:06 -05:00
evazion 1d14885bd5 post tooltips: reduce width/height, grey out unless hovered. 2018-04-30 02:20:06 -05:00
evazion 93471c99c9 post tooltips: position tooltips above thumbnail. 2018-04-30 02:20:06 -05:00
evazion 7e99a1b38b artist commentary form: add partial_commentary checkbox.
Add a checkbox for adding/removing the partial_commentary tag in the
artist commentary form.

ref: https://danbooru.donmai.us/forum_topics/15101.
2018-04-29 22:05:59 -05:00
evazion 21431892e8 post tooltips: increase delay 33%, remove gaps between tags. 2018-04-29 12:09:09 -05:00
evazion 47677aedf0 post tooltips: make scrollbar thinner. 2018-04-29 11:41:41 -05:00
evazion 862b1bc4c8 post tooltips: don't show if lost focus during ajax call (#3689).
Fix the tooltip appearing and getting stuck when the user mouses out
during the ajax request.
2018-04-29 01:58:39 -05:00
evazion 57203727b6 post tooltips: hide on keypresses (#3689). 2018-04-29 00:17:56 -05:00
evazion 08e25e40c5 post tooltips: disable tooltips on touchscreens (#3689).
On phones / tablets, long pressing a thumbnail sends emulated mouse events
that trigger the tooltip. Disable tooltips while touching is active.
2018-04-29 00:05:33 -05:00
evazion a6499b5169 post tooltips: add disable option (#3689).
* Add "disable post tooltips" account setting.
* Add back title attribute for when fancy tooltips are disabled.
2018-04-28 23:50:51 -05:00
evazion 1a29b96579 post tooltips: avoid positioning tooltips offscreen (#3689).
ref: http://qtip2.com/plugins#viewport.
2018-04-28 23:49:22 -05:00
evazion 0dcd303546 post tooltips: cache html after first api call (#3689).
Avoid triggering the API call each time you hover over the same post.
Overwrite `content.text` to save the results after the first call.
2018-04-28 23:49:03 -05:00
evazion e5db839e54 post tooltips: hide when clicking thumbnail (#3689). 2018-04-28 22:01:16 -05:00
evazion 603a27f495 related tags: fix deprecation warning in order("count(*) DESC").
DEPRECATION WARNING: Dangerous query method (method whose arguments are
used as raw SQL) called with non-attribute argument(s): "count(*) DESC".
Non-attribute arguments will be disallowed in Rails 6.0. 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 block in calculate_from_sample
at /home/admin/src/danbooru/app/logical/related_tag_calculator.rb:66)
2018-04-28 22:00:20 -05:00
evazion 4fd4cbd2a6 twitter: fix tests. 2018-04-28 12:33:05 -05:00
evazion 6b4a345378 rails 5: replace redirect_to :back with redirect_back
ref: https://blog.bigbinary.com/2016/02/29/rails-5-improves-redirect_to_back-with-redirect-back.html
2018-04-28 12:24:36 -05:00
evazion 18c40b0d60 Fix #3678: "Access denied" when adding commentary. 2018-04-27 18:32:15 -05:00
evazion 907881aced post tooltips: increase delay, constraint height, condense tags (#3666).
* Increase hover delay to 450ms.
* Set max height and add scrollbars for long tag lists.
* Condense tag list (don't put categories on separate lines).
2018-04-27 13:55:14 -05:00
evazion d731ec4393 Fix #3673: Autocomplete: hide menu after hitting space. 2018-04-27 13:24:23 -05:00
evazion c398c8fff6 autocomplete: trigger completion for metatags after typing colon (#3558)
When completing metatags (e.g. `rating:safe`), show completions
immediately after typing the colon (`rating:`), instead of after the
first letter (`rating:s`).
2018-04-27 01:22:26 -05:00
evazion 2f1d185c3e /posts.json: add is_favorited attribute (#3633)
ref: https://github.com/r888888888/danbooru/issues/3633#issuecomment-384863568.
2018-04-27 00:48:53 -05:00
evazion 6ab58104d4 jquery: fix obsolete use of load.
ref: https://jquery.com/upgrade-guide/3.0/#breaking-change-load-unload-and-error-removed
2018-04-27 00:38:46 -05:00
evazion 3ef23faae2 Fix #3669: Normalize mobile.twitter.com sources.
* Normalize sources to https://twitter.com/#{artist_name}/status/#{status_id} after upload.
* Make fetch source data use screen name instead of display name for the artist name.
2018-04-27 00:36:13 -05:00
evazion c9f35cbacc tag alias corrections: fix ActionView::Template::Error exception (#3668). 2018-04-27 00:17:14 -05:00
evazion 63a29247b2 post tooltips: disable on pool/favgroup order pages.
Disable to avoid tooltips appearing while trying to drag and drop.
2018-04-27 00:08:21 -05:00
evazion 72664e0105 saved searches: fix broken query/label autocomplete. 2018-04-26 23:55:13 -05:00
evazion a49cb1c105 jquery: fix obsolete uses of success (#3548). 2018-04-26 23:53:49 -05:00
evazion f7748a2ed7 jquery-ui: fix font color in notice boxes (#3671). 2018-04-26 23:28:00 -05:00
evazion dd2abeb180 jquery-ui: fix autocomplete menu styling (#3671).
* Wrap menu items in a div.
* Replace ui-state-focus with ui-state-active.
* Make active items have a grey background.

ref: http://jqueryui.com/upgrade-guide/1.12/#require-wrappers-for-each-menu-item
ref: http://jqueryui.com/upgrade-guide/1.12/#use-consistent-styling-for-focused-and-active-items
2018-04-26 23:18:00 -05:00
evazion a11dbb9186 jquery-ui: fix fonts in dialog boxes (#3671).
Fix the default jquery-ui theme overriding our body font with Arial.
2018-04-26 23:13:21 -05:00
evazion 36b819fdf8 notes.js: fix deprecated dialogClass option.
ref: http://jqueryui.com/upgrade-guide/1.12/#dialog
2018-04-26 22:11:17 -05:00
evazion 87c6698d55 sources.js: remove (dead code). 2018-04-26 21:33:28 -05:00
evazion f7a44ae8dd Fix redirect in "disable responsive mode" link. 2018-04-26 21:31:53 -05:00
evazion ed2b89a947 post tooltips: temp fix for jquery-ui 1.11 incompatibility.
ref: https://github.com/r888888888/danbooru/pull/3666#issuecomment-384775144
2018-04-26 15:49:14 -05:00
evazion bb3c88dbc8 thumbnails: replace browser tooltips with qtip2 tooltips (#3664). 2018-04-25 23:06:11 -05:00
evazion e772de40a7 posts: add /posts/{id}.html?variant=tooltip template. 2018-04-25 22:12:26 -05:00
evazion f2998585e9 tag_set_presenter: refactor inline_tag_list_html.
* Sort tags by category in inline tag lists (on /comments page, /uploads page, and modqueue).
* Move tags css to common/erb/tags.scss.erb.
2018-04-25 22:12:10 -05: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 fdd5ea3e78 Fix #3661: Account upgrade page directs to dead link instead of correct safebooru page. 2018-04-22 01:02:38 -05:00
evazion 8fb72ffcaf Fix #3660: Resize-to-fit broken for previews on upload page. 2018-04-20 21:26:06 -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
evazion 8083c7daae uploads: fix batch upload page to work without bookmarklet.
* Add a form to the /uploads/batch page so that it can be used without
  the bookmarklet.

* Fix an exception when no url is given.
2018-04-20 15:51:56 -05:00
evazion 09462aefeb Fix #3522: Enable HSTS. 2018-04-19 01:39:46 -05:00
evazion 2fd91bfa20 Load danbooru_default_config.rb earlier.
Load danbooru_default_config.rb inside application.rb instead of in an
initializer so that it's available as soon as possible.
2018-04-19 00:49:50 -05:00
evazion d70a0a64bd Remove controller-level force_ssl checks.
Obsoleted by force_ssl being globally enabled by default.
2018-04-19 00:49:50 -05:00
evazion c50ad41792 nginx.danbooru.conf: fix X-Forwarded-Proto.
Sending `http` is wrong, it causes a redirect loop if HSTS is enabled.
2018-04-19 00:45:55 -05:00
evazion 909c9aad5a Fix user id cache expiration.
Use a delayed job instead of a HTTP request to invalidate the user id
cache on both servers.
2018-04-19 00:45:51 -05:00
evazion e16ae00efc Fix hardcoded http:// urls. 2018-04-19 00:45:10 -05:00
evazion 83b96b4f3f Fix #3652: URL addons stripped when comments are created/edited. 2018-04-18 23:58:35 -05:00
evazion 5082a25321 uploads.js: fix call to $.unique (deprecated as of jQuery 3.0) 2018-04-18 19:02:17 -05:00
evazion 7d295a11d0 fixup! Fix #3654: Deviantart commentaries fail fetching. 2018-04-18 19:01:33 -05:00
evazion c4ae2bd2fa Fix #3654: Deviantart commentaries fail fetching. 2018-04-18 18:44:56 -05:00
evazion 9cafffd20a /user_upgrade/new: fix broken account upgrade link.
ref: https://danbooru.donmai.us/forum_posts/145267
2018-04-18 10:34:41 -05:00
evazion 0f883e7009 Fix #3649: Replace highlighting of "photoshop" with "third-party_edit" in modqueue. 2018-04-17 17:19:18 -05:00
evazion 17aabaca29 modqueue: move quality warning tags into config file. 2018-04-17 17:15:06 -05:00
evazion 41eba9d6b4 Move stylesheets/erb/* to stylesheets/specific/erb/*. 2018-04-17 16:55:52 -05:00
evazion 9b6136fb55 Fix missing parameter exception in /user_feedbacks/new.
ref: https://danbooru.donmai.us/forum_topics/9127?page=233#forum_post_145227
2018-04-17 10:23:55 -05:00
evazion e49e6f49bb Fix #3641: Can't add tags via Add Commentary dialog. 2018-04-16 12:12:28 -05:00
evazion 2c46191f99 artists: fix edit form fields not being prefilled.
* Fix the artist URLs field not being prefilled when clicking
  "Create new artist" in the "Fetch source data" box.

* Fix the artist name field not being prefilled when clicking
  "Create new artist entry" on the /artists/show_or_new?name=<name> page.
2018-04-14 21:26:45 -05:00
evazion d42ef7d7dc Fix #3642: Issues with sequential pagination.
As of Rails 5, overriding `to_a` on an ActiveRecord collection does
nothing. We need to override `records` instead.

ref: https://github.com/rails/rails/commit/cdd45fa09d76f7c16ccbb6682e672a44f82174a0
2018-04-14 10:56:20 -05:00
evazion 074b66bf27 pagination: prefer extending over `extend.
The `extending` method is the preferred way to add methods to an ActiveRecord collection.

* http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-extending
* https://ruby-doc.org/core-2.5.0/Object.html#method-i-extend
2018-04-14 10:56:16 -05:00