Commit Graph

733 Commits

Author SHA1 Message Date
evazion
f06e322dc0 Fix #4507: Clicking "View wiki" on Artists with no wiki redirects to the posts page. 2020-06-27 01:20:05 -05:00
evazion
f7f72e29b5 Fix #4458: Duplicate HTML IDs on post show page. 2020-06-26 14:59:30 -05:00
evazion
101e8a13b8 /posts: fix blank tag sidebars.
Fix the sidebar on the /posts index page sometimes being blank. This
could happen when either the related tag calculation was too slow and
timed out, or when Reporbooru was unavailable and we couldn't fetch the
list of popular tags.

In the tag list would otherwise be blank, we fall back to frequent tags
(the most common tags on the current page of results).

Also change it so that if Reportbooru is unconfigured, we fail
gracefully by returning blank results instead of failing with an
exception. This is so we can still view the popular searches and missed
searches pages during testing (even though they'll be blank).
2020-06-16 12:58:41 -05:00
evazion
a4df18e650 Refactor Reportbooru API clients.
* Combine MissedSearchService, PostViewCountService, and
  PopularSearchService into single ReportbooruService class.
* Use Danbooru::Http for these services instead of HTTParty.
2020-06-14 00:32:42 -05:00
evazion
63f675b7d6 config: remove enable_post_search_counts option.
Enable by default if reportbooru is configured, otherwise disable.
2020-06-02 14:41:06 -05:00
evazion
7a819b0060 artists: hide banned artist pages from anonymous users.
Hide banned artist pages from anonymous (logged out) users. Partial
revert of 6b066f2ca. Artists sometimes ask us to remove all their
information from the site, including their artist profile. It's easier
to hide their profile than to explain to Japanese artists that a) we're
under no obligation to remove their profile and b) we need to keep it to
maintain the ban on their content that they asked for.
2020-05-29 11:27:59 -05:00
evazion
24c53172db config: remove enable_image_cropping option.
There's no need to disable this option. Supporting it adds complexity
and disabling it is untested.
2020-05-17 15:01:59 -05:00
evazion
ea400296d4 Fix #4455: Two tag search gives option to create wiki page when one is a metatag. 2020-05-12 17:52:41 -05:00
evazion
a2814364ee presenters: merge PostSetPresenter into PostSet.
Reduce indirection. PostSet is basically a collection of helper methods
for rendering the post index page. PostSetPresenter was a set of helper
methods for rendering the tag list on the post index page. These don't
need to be separated.
2020-05-10 19:28:45 -05:00
evazion
67aab0236d search: apply aliases after parsing searches.
Make PostQueryBuilder apply aliases earlier, immediately after parsing
the search.

On the post index page there are multiple places where we need to apply
aliases:

* When running the search with PostQueryBuilder#build.
* When calculating the search count with PostQueryBuilder#fast_count.
* When calculating the related tags for the sidebar.
* When tracking missed searches and popular searches for Reportbooru.
* When looking up wiki excerpts.

Applying aliases after parsing ensures we only have to apply aliases
once for all of these things.

We also normalize the order of tags in searches and strip repeated tags.
This is so that we have consistent cache keys for fast_count.

* Fixes searches for aliased tags being counted as missed searches (fixes #4433).
* Fixes wiki excerpts not showing up when searching for aliased tags.
2020-05-07 13:53:35 -05:00
evazion
6937c40747 posts/index: update pending BUR notice criteria.
* Only show pending BUR notice on first page.
* Show pending BUR notice for all searches that include a single tag.
2020-05-04 02:49:48 -05:00
evazion
2cbe4d3672 search: add unaliased:<tag> metatag.
* Add unaliased:<tag> metatag. This allows you to search for a tag
  without applying aliases. This is mainly useful for debugging purposes
  and for searching for large tags that are in the process of being
  aliased but haven't had all their posts moved yet.

* Remove the "raw" url param from the posts index page. The "raw" param
  also caused the search to ignore aliases, but it was undocumented and
  exploitable. It was possible to use the raw param to view private
  favorites since favorites are treated like a hidden tag.
2020-04-30 17:45:07 -05:00
evazion
b1c494aa34 posts/index: fix bad call to post_search_count_js. 2020-04-28 01:04:17 -05:00
evazion
abda687345 posts/index: fix search count tracking.
* Eliminate "&ms=1" url param.
* Only track simple single-tag searches (not multi-tag searches,
  metatags, negated tags, etc).
2020-04-27 19:12:16 -05:00
evazion
d5a7fafca1 posts/index: fix several "This tag is under discussion" issues.
Several fixes for the "This tag is under discussion" notice on the post
index page:

* Fix the notice appearing for BURs that aren't pending.
* Fix the notice never going away because of the cache never expiring.
* List all topics when a tag is involved in multiple BURs.
* Link to the forum post instead of the forum topic (fix #4421).
* Optimization: don't check for BURs when the search isn't a simple
  single tag search.
* Add a `tags` field to the bulk update requests table for tracking all
  tags involved in the request (excluding tags in mass updates that are
  negated/optional/wildcards). Known issue: doesn't handle tag type
  prefixes in mass updates correctly (e.g. `mass update foo -> artist:bar`
  doesn't detect the tag `bar`).
* Allow searching the /bulk_update_requests page by tags.

We don't really need to cache the notice here, but we do it anyway to
reduce queries on the post index page.
2020-04-27 19:11:47 -05:00
evazion
911ed34b76 post tooltips: use underscores instead of spaces in pool names.
Don't use pretty names (spaces instead of underscores) for pools in post
tooltips. This is for consistency with tags (which have underscores
here) and for easier copy & pasting.
2020-04-27 14:10:12 -05:00
evazion
35824c9e45 posts: remove AddThis widget.
AddThis apparently pulls in a script from z.moatads.com now. Fuck that.
2020-04-23 13:38:24 -05:00
evazion
dd0d9dff4a search: move misc search parsing helpers to PostQueryBuilder.
* Move various search parser helper methods (`has_metatag?`,
  `is_single_tag?` et al) from PostSets and the Tag model to
  PostQueryBuilder.

* Fix various minor bugs stemming from trying to check if a search query
  contains certain metatags using regexes or other adhoc techniques.
2020-04-23 01:51:30 -05:00
evazion
ab4d596ac2 Fix #4405: Post version table css doesn't keep ratio at smaller resolutions.
Bug: extremely long sources cause the Tags column to become extremely
wide. Caused by the source link not having the word-break property set.

Fix: use post_source_tag, which lets the `a[rel=external] { word-break: break-word; }`
rule take effect.

Example: https://danbooru.donmai.us/post_versions?search%5Bpost_id%5D=3809742
2020-04-17 01:46:14 -05:00
evazion
c5260f4927 posts: don't cache rendered notes.
Don't cache rendered notes in Redis. Rendering notes shouldn't be
expensive normally.
2020-03-28 18:25:30 -05:00
evazion
70aac1d4b8 Fix #4372: Wrong attribute name in opengraph tags. 2020-03-28 15:38:15 -05:00
evazion
5d12081e58 posts: add » links for uploaders and approvers. 2020-03-28 00:26:31 -05:00
evazion
1af6850c7c posts: add "view original" sidebar option.
* Add a "View original" sidebar option.
* Rename the "View large" sidebar option to "View smaller".
* Remove the "Loading..." message when switching image sizes.
* Fix the V hotkey not working after using it once.
* Change #image-resize-link to .image-view-original link (note that
  there are two of these links now, one in the notice bar and one in the
  sidebar).
* Add a `data-post-current-image-size` attribute on the <body> element
  and use it to control visibility of links and notices.
2020-03-26 22:03:47 -05:00
evazion
87a51129b8 posts: add back "resize to window" link.
* Add back "Resize to window" link.
* Add Z shortcut for resize to window link (mnemonic: Z for zoom image).
* Resize images to screen width by default on both desktop and mobile.
* Make it so that notes are nested directly inside the .image-container
  element with the image, instead of inside a separate .note-container
  element. This means .image-container and .note-container are now the
  same element. This is so that the size of the .note-container is
  driven by the size of the image, which ensures that notes are
  automatically resized as the image is resized.
2020-03-26 21:55:59 -05:00
evazion
1126147dee posts: change #image-container, #note-container to classes.
Change #image-container and #note-container from IDs to classes. This is
necessary so that we can use one container element for both the image
container and the note container. This may break custom CSS and
userscripts.
2020-03-26 18:17:13 -05:00
evazion
50b0b79891 comments: adjust link to howto:comment.
Replace the giant banner about reading the comment guidelines with a
smaller link to howto:comment beneath the comment text box.
2020-03-24 18:32:30 -05:00
evazion
d51b0dfe17 pundit: convert moderator/post/posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
a5418abb31 pundit: convert posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
415d9591c5 pundit: convert post votes to pundit.
Side effects:

* The data-current-user-is-voter <body> attribute has been removed.
* {{upvote:self}} no longer works. {{upvote:<name>}} should be used instead.
2020-03-20 18:03:01 -05:00
evazion
f1f489c40b pundit: convert favorites to pundit. 2020-03-20 18:03:01 -05:00
evazion
2bc99a813c Merge pull request #4320 from BrokenEagle/note-dimension-percentages
Convert notes to use percentages instead of exact coordinates
2020-03-20 16:26:02 -05:00
BrokenEagle
d84150b232 Fix posts not being processed by blacklist after post updates
- Blacklisting individual posts was moved into its own function
- Fixed Javascript variables being leaked into the user environment
- Fixed post qTips being orphaned by replacements by destroying them first
- Moved edit form check into post success to avoid repeating post check
2020-03-07 08:13:08 +00:00
evazion
d344005f8f tag scripts: fix deleted thumbnails being removed.
Fix thumbnails being removed when using tag scripts on deleted thumbnails.
2020-03-06 23:23:38 -06:00
BrokenEagle
a206c9d6ac Added a view large link to facilitate switching between image sizes
- The link is placed in the Options section
-- In the same place as the now defunct "Resize to image" link
-- This was so that it doesn't interfere with the image when in full size
2020-03-04 00:35:45 +00:00
BrokenEagle
e844a06e61 Convert notes to use percentages instead of exact coordinates
- This allows for the note boxes to be easily resized
-- Now resizing the note container resizes all of the note boxes
-- The z-index and position values had to be adjusted for this
--- So that the note/preview boxes were still visible
--- So that the image was selectable with right clicks
- All of the inner box styles have been moved to the outer box
-- Now the inner box is only a container for the note body
- The always resize image option has been removed from user settings
-- The value still exists on the model for future rename/reuse
- The max width is set at 100% for responsive mode to fit the screen
2020-03-04 00:35:42 +00:00
evazion
475d6ae7cf modqueue: move url from /moderator/post/queue to /modqueue. 2020-02-29 17:46:58 -06:00
evazion
869142ed1b Fix #4314: Favorite/vote modes give generic error messages.
Refactor tag scripts to fix multiple issues:

* Errors during tag scripting didn't show the actual error message, just
  a generic "There was an error updating post #NNN" message.
* The quick edit form didn't show any error messages at all on failure.
* Thumbnails didn't have all their data attributes properly updated
  after the post was updated.

This changes it so that thumbnails have their html fully replaced after
updating. This has the side effect of removing event handlers bound
directly to the thumbnail. A `danbooru:post-preview-updated` event is
fired in case userscripts need to detect when thumbnails are updated.
2020-02-27 19:23:48 -06:00
evazion
e29e9eda49 posts: remove ban confirmation page.
Use a dialog instead of a separate page to confirm bans.
2020-02-27 00:19:03 -06:00
evazion
e1362faf0d mode menu: remove forgotten approve menu option. 2020-02-25 01:04:59 -06:00
evazion
463b1b734e Add curated posts page.
Add a curated posts page at /explore/posts/curated. Curated posts are
the most favorited posts by contributor-level users (users with
unlimited upload permissions).

Also add an order:curated tag using for use in regular searches.
2020-02-23 17:52:38 -06:00
evazion
faf852d18e approvals: remove post undelete endpoint.
Remove `POST /moderator/post/undelete` endpoint. Replace it with
`POST /post_approvals` instead.

Fixes it so that undeleting a post has the same behavior as approving a
post. Namely, it reloads the page instead of just flashing a "Post was
undeleted" message.
2020-02-20 15:49:31 -06:00
evazion
f47c56d976 approvals: move post approval endpoint to /post_approvals.
Move the post approval endpoint from `POST /moderator/post/approval` to
`POST /post_approvals`.
2020-02-20 15:49:18 -06:00
evazion
c89c7ccc63 mode menu: remove post ban, rating lock, note lock options. 2020-02-20 03:42:07 -06:00
lllusion3469
090671cedf fix leftover reference to Artist.notes 2020-02-18 21:42:52 +01:00
evazion
a214989447 controllers: move /moderator/post/disapprovals to /post_disapprovals. 2020-02-15 07:10:45 -06:00
evazion
edfef10dc9 Fix #1883: Add <link> elements for all paginated pages.
Add <link rel="prev"> and <link rel="next"> elements to most pages with
pagination. This should work on all index pages, but it won't work for
things like pool or forum topic show pages.

Also remove the <link rel="top"> element (wasn't useful, was just a link
back to the root url).
2020-01-31 02:43:08 -06:00
evazion
6b066f2cab Fix #4275: Unable to update "banned artist" entries.
Allow all users to view and edit artist entries and wiki pages belonging
to banned artists. There was little need to hide these pages from
Members, it was mainly to appease artists who didn't like us even
linking to their sites.

These restrictions also had multiple flaws:

* Banned artist information was still visible in the API.
* It was still possible to edit banned artists using the API.
* It was still possible for unprivileged users to revert banned
  artist entries or wiki pages to previous versions.
* The restrictions were inconsistent: in various places they were
  either Member-only, Gold-only, or Builder-only.
2020-01-31 02:43:08 -06:00
evazion
aa442121bb views: refactor open graph / twitter <meta> tags.
* Fix og:site to og:site_name.
* Fix open graph properties to use <meta property="...">, not <meta name="...">>
* Set og:type, og:site_name, twitter:site globally (not just on post pages).
* Set og:url.
* Remove unused always-resize-images, report-server <meta> tags from
  post show pages.
2020-01-27 00:47:24 -06:00
evazion
aeec46b212 views: move inline javascript to app bundle. 2020-01-26 19:16:38 -06:00
evazion
c36c0b9e7a views: refactor atom feed links.
* Fix comment & forum feeds to include search params.
* Remove global post feeds (only include post feeds on post index).
2020-01-26 19:16:38 -06:00