Commit Graph
100 Commits
Author SHA1 Message Date
evazion b915f1c586 Revert "application model: move pagination extension to concern."
This reverts commit 7855e36d17.

Broke pagination due to incorrect memoization causing @paginator_count
to be shared between requests.
2020-02-25 01:07:09 -06:00
evazion e1362faf0d mode menu: remove forgotten approve menu option. 2020-02-25 01:04:59 -06:00
evazion 406bc5d87f Add /pixiv_ugoira_frame_data.json endpoint. 2020-02-24 22:43:03 -06:00
evazion 7c71311eef Add /favorites.json endpoint. 2020-02-24 22:42:59 -06:00
evazion 928c7f8a0a Merge pull request #4281 from BrokenEagle/embedded-notes-improvements
Add embedded notes improvements
2020-02-24 01:13:13 -06:00
evazion 319510f2e9 Update ruby gems. 2020-02-23 17:52:38 -06:00
evazion ce11485fe0 Remove super voters. 2020-02-23 17:52:38 -06:00
evazion 1591df0351 Remove curated pool updater. 2020-02-23 17:52:38 -06:00
evazion 01e9020b6a popular posts: add pagination. 2020-02-23 17:52:38 -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 e8590afa6d popular posts: fix date range handling.
* Fix the next button for the weekly timescale to jump to the next week,
  not the next day.
* Show the start and end dates for the weekly timescale.
* Use `Time.zone.today` instead of `Date.today` to respect the user's
  timezone setting.
2020-02-23 17:26:08 -06:00
evazion 76259265de posts: fix noter:<name> metatag. 2020-02-23 17:26:08 -06:00
evazion cc9298cf46 posts: fix newpool:<name> metatag. 2020-02-23 17:26:08 -06:00
evazion e47d0e0d05 models: set more creator names explicitly.
Set creators explicitly for bans, BURs, comment votes, and posts.
2020-02-23 17:26:08 -06:00
evazion 3a018ee9f7 dmails: set sender name and ip address explicitly.
Set the sender name and IP addresses explicitly in the controller rather
than implicitly in the model.

Fixes cases where automated dmails from DanbooruBot had their IP
addresses set to the person who triggered the dmail, even though they
didn't actually send the dmail themselves.
2020-02-23 17:26:08 -06:00
evazion 7855e36d17 application model: move pagination extension to concern. 2020-02-23 17:26:04 -06:00
evazion c53e4e7155 Merge pull request #4300 from BrokenEagle/fix-note-version-dimension-columns
Only show dimension transitions on relevant changes
2020-02-23 01:02:03 -06:00
evazion 1ce01df3db Merge pull request #4302 from BrokenEagle/fix-nonembedded-note-resizing
Restrict note container resizing to embedded notes
2020-02-23 01:01:44 -06:00
evazion b31409a586 Merge pull request #4306 from BrokenEagle/fix-commentary-version-post-search
Fix searching artist commentaries by post ID
2020-02-23 01:01:26 -06:00
evazion 81532fdbac wiki_pages/search: fix title field. 2020-02-23 00:30:04 -06:00
evazion a181e6d0db Fix #1898: Include alias predicates in non-empty Tags search.
Make searches on the /tags index includes aliases too. Show matching
aliases like this:

   Name: gray*

   ? 75098 grey_hair <- gray_hair
   ? 35345 grey_eyes <- gray_eyes
2020-02-23 00:29:17 -06:00
evazion a8e5412d9c implications: refactor calculation of implied tags.
Refactor to use a recursive CTE to calculate implied tags in SQL, rather
than storing them in a descendant_names field. This avoids the
complexity of keeping the stored field up to date. It's also more
flexible, since it allows us to find both descendant tags (tags that
imply a given tag) as well as ancestor tags (tags that are implied by a
given tag).
2020-02-22 22:37:36 -06:00
evazion 83a3ed85dd Fix #4308: pixiv_ugoira_frame_data not available through API anymore. 2020-02-22 19:07:35 -06:00
evazion 2d7f77ce03 implications: remove memoization of parents, descendants, forum_updater.
Not necessary for performance and flushing the cache at the right times
added some complexity.
2020-02-22 02:09:30 -06:00
evazion c6de2ecd12 aliases: remove minimum post count requirement.
Remove the soft requirement that the destination tag must have 50 posts
in order to request an alias. This often gets in the way when trying to
rename a tag to a new name that doesn't already exist.
2020-02-22 01:42:01 -06:00
evazion c1f7b76bdb dtext: refactor parsing of embedded BUR pseudo tags. 2020-02-22 01:37:12 -06:00
evazion ca1492c8ca aliases/implications: don't retry if approving fails.
This was originally meant to deal with statement timeouts when updating
tags. This is no longer a problem.
2020-02-22 01:20:29 -06:00
evazion d915009407 aliases/implications: remove dead approving/updating code.
Remove the edit, update, and approve endpoints for tag aliases and
implications. These have been useless since individual alias and
implication requests were removed. Aliases and implications could only
be edited or approved if they were in the pending state, which is no
longer possible.

Also remove unused new alias/implication request forms.
2020-02-22 01:20:23 -06:00
evazion 2f5255f6b7 user presenter: fix syntax error in previous names.
Fixup for 0ad42d23c.
2020-02-21 00:20:18 -06:00
evazion 9b58cb7b42 mode menu: remove approve option.
Remove the approve option from the post mode menu. Mass approving posts
is rarely needed. The javascript was also buggy (it didn't update the
data attributes correctly when undeleting a post).

The replacement for this feature is to use a tagscript with the
status:active tag.
2020-02-20 17:43:33 -06:00
evazion d7e0b5aa90 posts: add metatags for approving and banning posts.
* Allow approvers to approve a post by tagging it with status:active.
* Allow approvers to ban a post by tagging it with status:banned.
* Allow approvers to unban a post by tagging it with -status:banned.
2020-02-20 17:42:32 -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 610ad9e119 mode menu: refactor favorite and vote options. 2020-02-20 03:42:07 -06:00
evazion c89c7ccc63 mode menu: remove post ban, rating lock, note lock options. 2020-02-20 03:42:07 -06:00
evazion 0ad42d23c9 models: refactor search visibility methods.
Refactor how model visibility works in index actions:

* Call `visible` in the controller instead of in model `search`
  methods. This decouples model visibility from model searching.

* Explicitly pass CurrentUser when calling `visible`. This reduces
  hidden dependencies on the current user inside models.

* Standardize on calling the method `visible`. In some places it was
  called `permitted` instead.

* Add a `visible` base method to ApplicationModel.
2020-02-19 17:08:59 -06:00
evazion bd6d896ee0 models: factor out concerns to app/logical/concerns. 2020-02-19 16:37:24 -06:00
evazion f54470ddfb post disapprovals: fix tests and API create action.
* Fix tests.
* Fix create action in API (couldn't redirect to show action).
* Clean up user initialization.
2020-02-19 15:20:39 -06:00
evazion 0aa05a116f burs/index: add back forum post link.
Add back forum post link removed in ff8bfee9e.
2020-02-18 19:22:57 -06:00
evazion 72e56d8856 PostPresenter.preview: standardize on show_deleted: true.
Standardize on using `show_deleted: true` instead of `tags: "status:any"`
when rendering thumbnails and we want to show deleted thumbnails.

Also fixes it so that deleted thumbnails are shown when reordering pools
and favorite groups.
2020-02-18 19:22:57 -06:00
evazion 1244e02fe2 pixiv: handle new https://i-f.pximg.net urls. 2020-02-18 19:22:57 -06:00
evazion 3104a78100 Merge pull request #4297 from BrokenEagle/add-cosplay-related-tags
Add cosplay related tags for other wikis
2020-02-18 15:58:39 -06:00
evazion fcf5dadc2b Merge pull request #4298 from lllusion3469/patch-5
fix leftover reference to Artist.notes
2020-02-18 15:55:39 -06:00
evazion 9f12a4052d Merge pull request #4294 from BrokenEagle/use-model-counts
User: Use model counts instead of SQL queries
2020-02-18 14:48:58 -06:00
evazion 187565125c Merge pull request #4296 from BrokenEagle/fix-autocomplete-insert-completion
Fix autocomplete insert completion
2020-02-18 14:41:24 -06:00
evazion 9c6ef424ef post_flags/index: remove banned and duplicate search options.
Remove options for searching for "Artist requested removal" and
"duplicate" flag reasons. These were legacy flag reasons that haven't
been used for a long time.
2020-02-17 02:13:34 -06:00
evazion 83a0cb0a71 models: refactor class methods into scopes. 2020-02-17 02:10:08 -06:00
evazion 9a8aa1990d notes: clean up note-locked validation. 2020-02-16 23:19:49 -06:00
evazion 7723597675 notes: drop unused undo_changes_by_user method. 2020-02-16 23:10:24 -06:00
evazion 2dab9aa075 models: remove creator_id from artists, notes, and pools.
Remove the creator_id field from artists, notes, and pools. The
creator_id wasn't otherwise used and was inconsistent with the
artist/note/pool history in some cases, especially for old artists.
2020-02-16 23:09:00 -06:00
evazion 207861fd40 api: remove available_includes dependent on current user.
This is to avoid specifying permissions in multiple disjoint places and
because most API users shouldn't need these fields.
2020-02-16 23:07:06 -06:00
evazion 9ef80d7344 post_disapprovals/index: don't show usernames to other users.
* Don't show who disapproved the post to other users. Only show the
  creator to mods or to the disapprover themselves.
* Let unprivileged users see the /post_disapprovals index.
2020-02-16 21:32:06 -06:00
evazion ff8bfee9eb burs/index: link to forum topic instead of specific post.
Linking to the last post in the thread triggers a COUNT(*) to calculate
the last page.
2020-02-16 19:52:14 -06:00
evazion 5817af4014 burs/show: remove BUR update count estimate.
Remove the post update count estimate from BUR show pages. This was
complex, slow, and usually inaccurate since it assumed that requests in
a BUR had no overlap with each other, which usually wasn't the case.
2020-02-16 19:21:56 -06:00
evazion c4521acb54 burs/index: format update scripts as dtext, same as forum.
Format scripts on the BUR index page as dtext, the same way they're
formatted in forum posts. This means that tags have colors and underlines,
but they don't have post counts. Gathering post counts was too slow.
2020-02-16 19:20:48 -06:00
evazion ef3188a7fe artists/edit: refactor editing nested wiki pages.
Refactor to use accepts_nested_attributes_for instead of the notes
attribute to facilitate editing wikis on the artist edit page.

This fixes the notes attribute unintentionally showing up in the API.

This also changes it so that renaming an artist entry doesn't
automatically rename the corresponding wiki page. This had bad behavior
when there was a conflict between wiki pages (the wikis would be
silently merged, which usually isn't what you want). It also didn't warn
about wiki links being broken by renames.
2020-02-16 18:48:41 -06:00
evazion 6f3d0b542c wiki_pages/search: fix title search not allowing wildcards. 2020-02-16 18:48:41 -06:00
evazion ed702b8854 Fix deprecated keyword argument warnings in Ruby 2.7.
Fix this warning:

    warning: Using the last argument as keyword parameters is
    deprecated; maybe ** should be added to the call.

ref: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/#delegation
2020-02-16 18:48:41 -06:00
evazion af4891bf4c Upgrade to ruby 2.7. 2020-02-16 18:48:41 -06:00
evazion 1385e60f8c Update ruby gems and yarn packages. 2020-02-16 13:08:23 -06:00
evazion d3bbd82d8b application record: drop execute_sql, select_value_sql methods. 2020-02-16 05:56:23 -06:00
evazion 9caa9d8117 post versions: drop unused presenter method. 2020-02-16 05:38:53 -06:00
evazion d01c6b773c application model: drop unused test_connection method. 2020-02-16 05:38:50 -06:00
evazion 1370b034d1 api: don't include can_comment_vote? on users.
This triggers multiple comment vote count(*) calls when doing things
like /posts.json?only=uploader and the current user is in the set of
uploaders.
2020-02-16 05:03:58 -06:00
evazion 835cc23f66 forum post votes: fix exploits with voting on mod-only forum posts.
* Don't allow unprivileged users to vote on mod-only forum posts.
* Don't allow unprivileged users to see votes on mod-only forum posts.
2020-02-16 04:51:23 -06:00
evazion bf4dbf1449 forum posts: replace joins with subqueries.
Using subqueries here avoids some nasty large joins.
2020-02-16 04:43:57 -06:00
evazion 7e67d3dd9c views: replace .category-N css classes with .tag-type-N
* Replace the .category-N CSS classes on tags with .tag-type-N. Before
  we were inconsistent about whether tag colors were indicated with
  .category-N or .tag-type-N. Now it's always .tag-type-N.

* Fix various places to not use Tag.category_for. Tag.category_for does
  one Redis call per tag lookup, which leads to N Redis calls on many
  pages. This was inefficient because usually we either already had the
  tags from the database, or we could fetch them easily.
2020-02-16 04:35:37 -06:00
evazion 998eece95d controllers: allow banned users to use GET actions.
Make member_only et al only apply to non-GET actions. This avoids doing
IP ban checks when simply viewing members-only pages.
2020-02-16 04:21:20 -06:00
evazion 594c4ea0c9 respond_with: fix for non-activemodel responses. 2020-02-16 04:05:09 -06:00
evazion caf54fe45a blacklists: remove ability for mods to blacklist uploaders by name. 2020-02-16 04:00:42 -06:00
evazion b591353773 /dmails: don't default to 'received' folder.
Don't make /dmails default to the received folder when no other folder
is specified. This is surprising in the API because it means
/dmails.json only shows received dmails by default, not all dmails. This
isn't necessary either since everything that links to dmails already
specifies the received folder.
2020-02-16 03:36:10 -06:00
evazion 8024d9f0ba /comment_votes: fixup creator_name reference. 2020-02-16 03:28:45 -06:00
evazion bbabaffb07 /comment_votes: make visible to banned users.
Let banned users see their own comment votes.
2020-02-16 03:24:21 -06:00
evazion a214989447 controllers: move /moderator/post/disapprovals to /post_disapprovals. 2020-02-15 07:10:45 -06:00
evazion 60ff2ae929 models: rename post/pool archives to post/pool versions. 2020-02-15 06:52:10 -06:00
evazion 51f3f7338a models: remove old post version and pool version models. 2020-02-15 06:21:00 -06:00
evazion 2564e885c8 controllers: refactor only param includes.
Add extra includes needed by the `only` param inside `respond_with`.
2020-02-15 06:17:22 -06:00
evazion 8649ff6dbe API: remove various associated fields included by default.
Remove various associated fields that were included by default on
certain endpoints. API users can use the only param to include the
full association if they need these fields.

* /artists.json: urls.
* /artist_urls.json: artist.
* /comments.json: creator_name and updater_name.
* /notes.json: creator_name.
* /pools.json: creator_name.
* /posts.json: uploader_name, children_ids, pixiv_ugoira_frame_data.
* /post_appeals.json: is_resolved.
* /post_versions.json: updater_name.
* /uploads.json: uploader_name.
2020-02-15 06:17:11 -06:00
evazion c5bcfb962f parameter builder: remove binding.pry statement. 2020-02-14 17:35:02 -06:00
evazion 1e426a50f7 controllers: standardize request format checks. 2020-02-14 17:28:25 -06:00
evazion c0cca18091 Merge pull request #4288 from BrokenEagle/nested-only-parameter
Add ability to use nested only parameter
2020-02-14 17:23:54 -06:00
evazion dd425830ca Update gems.
Fixes a showstopper bug in rack-2.2.0 that prevents puma from booting.
2020-02-10 18:45:34 -06:00
evazion be66141074 artists/summary: show urls as bulleted list. 2020-02-10 17:11:38 -06:00
evazion a6f11610bd artists/summary: remove list of top source domains.
Remove the list of most-used source domains from artist summaries. This
took up a lot of space and usually wasn't very useful. It was also slow.
We had to calculate this on every artist tag search so we could display
it in the Artist tab, even though usually the user didn't open the tab.
2020-02-10 17:11:38 -06:00
evazion 3ef4d9c7ac artists/summary: link other names to artist searches.
* Link other names to artist searches instead of to the new artist page.
* Remove the asterisk next to other names indicating the name isn't used
  as the primary name of another artist. This is almost always the case.
2020-02-10 17:11:38 -06:00
evazion 4ed716e90d Update ruby gems and yarn packages. 2020-02-10 17:11:38 -06:00
evazion aaafd230e4 Merge pull request #4291 from BrokenEagle/rework-version-views
Rework version views
2020-02-10 16:46:42 -06:00
evazion 01e42b7063 Merge pull request #4277 from BrokenEagle/fix-pawoo-source
Fix Pawoo source
2020-02-08 16:56:10 -06:00
evazion 094b9e6d07 Fix #4287: Hide Dmail notice persistently shown even after closing 2020-02-05 20:47:55 -06:00
evazion 960ed8934b wiki_pages/new: fix exception in rendering html data attributes.
Fix exception when trying to get the category_name for the html data
attributes. The wiki title is nil here and Tag.category_for couldn't
handle a nil tag name.
2020-02-05 18:36:55 -06:00
evazion 69f653b0c4 forum_topics/show: fix N+1 query patterns. 2020-02-05 18:08:39 -06:00
evazion db4c67ee86 Fix #4286: Mod dashboard: limit width of left column. 2020-02-05 16:59:54 -06:00
evazion 9322c596e2 Fix #4279: Very long tags break forum post format.
* Enable word breaks for all DText-formatted text. Ensures extremely
  long strings in comments get broken.

* Fix the author column on comments/forum posts to use a fixed 12em
  width (except on the mobile layout). Using flex-basis was wrong because
  it allowed the author column to shrink if the other column was too wide.
2020-02-05 16:49:04 -06:00
evazion 327bc46bd2 Fix #4283: Profile no longer viewable through API. 2020-02-05 15:39:53 -06:00
evazion ccb87e13b1 Fix #4282: Related tag search no longer allows the JSON/XML formats. 2020-02-05 14:38:32 -06:00
evazion 2d0e0769cb /ip_addresses: add paginator to group_by=(user|ip_addr) pages. 2020-02-05 14:28:30 -06:00
evazion 089c304992 paginator: fix page counts for relations with group by clauses.
Fix an invalid SQL exception that occurs when the paginator tries to
do a COUNT(*) to calculate the page count of a relation that already
includes a GROUP BY + COUNT(*) clause. We need to nest the whole query
inside a `SELECT COUNT(*) FROM (...)` subquery so the inner COUNT(*)
doesn't mess up the outer COUNT(*).

Fixes #4285.
2020-02-05 14:27:48 -06:00
evazion 6b3c541a8a /ip_addresses: temp fix for exception when using group_by param.
Calling next_page here raises an exception when calculating the page
count because it can't handle SQL containing a GROUP BY clause. Swallow
the exception as a temp fix.
2020-02-04 03:59:10 -06:00
evazion 96b565f61d users: temp fix exception when is_banned is inconsistent.
Fix an exception when is_banned is true but the user doesn't have a ban
record.
2020-02-04 03:51:59 -06:00
evazion fcfdd94fe9 controllers: temp fix exception in show actions.
Temp fix a regression caused by c7185724d.
2020-02-04 03:51:59 -06:00