Commit Graph

8894 Commits

Author SHA1 Message Date
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
BrokenEagle
e807326372 Use association on post flags instead of doing a new query
- Because associations can be preloaded in the controller
2020-02-12 23:58:55 +00:00
BrokenEagle
75f4af8991 Don't do unnecessary processing on posts when using the API 2020-02-12 23:58:54 +00:00
BrokenEagle
f7495f5e26 Removed unused controller code 2020-02-12 23:58:54 +00:00
BrokenEagle
63b3503bfc Add ability to use nested only parameter
- The only string works much the same as before with its comma separation
-- Nested includes are indicated with square brackets "[ ]"
-- The nested include is the value immediately preceding the square brackets
-- The only string is the comma separated string inside those brackets
- Default includes are split between format types when necessary
-- This prevents unnecessary includes from being added on page load
- Available includes are those items which are allowed to be accessible to the user
-- Some aren't because they are sensitive, such as the creator of a flag
-- Some aren't because the number of associated items is too large
- The amount of times the same model can be included to prevent recursions
-- One exception is the root model may include the same model once
--- e.g. the user model can include the inviter which is also the user model
-- Another exception is if the include is a has_many association
--- e.g. artist urls can include the artist, and then artist urls again
2020-02-12 23:58:53 +00: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
BrokenEagle
e0e60a9546 Remove dead embedded code 2020-02-10 17:23:27 -06:00
BrokenEagle
778619301e Resize font and other size parameters when the image resizes
- Each element has the size style elements scaled to the font size with "em"
-- The font size of the element is scaled in percentage to the parent element
- All sizes are then scaled by changing the font size of the note container
- The scale resize calculation uses the large image size
-- Since this is the assumed default size for a user
- Preview sets the font size of the inner box to the base font size
-- This allows the calculations to be performed correctly
2020-02-10 17:22:27 -06:00
BrokenEagle
44bcef03e1 Add additional styles for embedded notes
- Use CSS classes instead of applying the styles to the elements.
-- Allows a user to override any of the default styles being applied.
- Remove the borders and handles when not hovering over the box.
- Increase the opacity for embedded notes to full to avoid conflicts with
  the text underneath.
- Decrease the opacity a little when editing embedded notes.
-- Allows for better seeing of the text underneath while still being able
   to see the translation text above.
-- Compensated for by showing full opacity when hovering over the note box.
2020-02-10 17:20:56 -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
BrokenEagle
8ff00cfc7d Rework post version view
- Added a changes column explicitly listing all of the changes
-- This makes it more in line with the other views now
2020-02-08 22:57:30 +00:00
BrokenEagle
7b1efd1204 Rework artist versions index view
- Added a changes column explicitly listing all of the changes
-- This makes it more in line with the other version views now
- Does a symmetric difference on the array fields to detect changes
2020-02-08 22:57:29 +00:00
BrokenEagle
de1324098d Rework wiki page versions index/diff views
- Changed to using the diff-body CSS class
-- Removed unnecessary elements from the CSS style file
- Does a symmetric difference on the array fields to detect differences
- Add more descriptors to the status/changes column
- Specifically add <br> to statuses to cause line breaks
2020-02-08 22:57:29 +00:00
BrokenEagle
ede7167bb8 Rework pool versions index/diff views
- Changed to using the diff-body CSS class
-- Removed unneeded CSS style file
- Removed trailing whitespace after the >>> link
-- It was causing artifact line-throughs to appear after the link
- Changed the diff link to only render when a text field has changed
-- Because the post changes are already shown on the index view
- Specifically add <br> to statuses to cause line breaks
2020-02-08 22:57:29 +00:00
BrokenEagle
d62f7e786e Revise display on artist commentary versions index
- All text fields are now shown in their non-rendered form
-- This allows changes to be highlighted with the diff builder
-- The different fields were labeled and separated for easier discernment
-- Fields are only shown if they have text in either the current or previous versions
- Various changes are also verbalized for easier discovery
- The date and the user columns were combined
-- This is more in line with other indexes, plus it saves on space
- The revert listing was changed to use a thumbnail instead of post ID links
-- This makes it more in line with the post versions index
2020-02-08 22:57:28 +00:00