Commit Graph
100 Commits
Author SHA1 Message Date
evazion 94ae10b1a6 tests: fix post and pool version tests helpers.
* Fix the pool version SQS service to always be mocked before every
  test. Before we had to manually set it up before every test dealing
  with pool versions.

* Fix it so that we reconnect to the post/pool version databases before
  every test. Before using $ARCHIVE_DATABASE_URL to set the database url
  failed because environment variables weren't loaded by dotenv yet when
  connections were first established.
2020-03-21 19:28:10 -05:00
evazion 3cb2c10be8 Merge pull request #4349 from danbooru/refactor-pundit
Refactor authorization logic to use Pundit
2020-03-20 18:47:33 -05:00
evazion d775c625bb application controller: remove role_only! methods. 2020-03-20 18:03:50 -05:00
evazion 79e7b9308e pundit: convert misc privilege checks in views to pundit. 2020-03-20 18:03:50 -05:00
evazion 7f742242e4 pundit: convert uploads to pundit. 2020-03-20 18:03:01 -05:00
evazion d51b0dfe17 pundit: convert moderator/post/posts to pundit. 2020-03-20 18:03:01 -05:00
evazion 1344d4c161 pundit: convert moderator/dashboard to pundit.
Make it visible to everyone since there's no non-public information here.
2020-03-20 18:03:01 -05:00
evazion a5418abb31 pundit: convert posts to pundit. 2020-03-20 18:03:01 -05:00
evazion dd39913e55 pundit: convert post replacements to pundit. 2020-03-20 18:03:01 -05:00
evazion 3bb3c0b990 pundit: convert saved searches 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 33d81d0d1b pundit: convert post flags to pundit. 2020-03-20 18:03:01 -05:00
evazion ffae64f127 pundit: convert post versions to pundit. 2020-03-20 18:03:01 -05:00
evazion ba0a5dda8a pundit: convert post disapprovals to pundit. 2020-03-20 18:03:01 -05:00
evazion 84c654464d pundit: convert post approvals to pundit. 2020-03-20 18:03:01 -05:00
evazion cbee23f9ad pundit: convert post appeals to pundit. 2020-03-20 18:03:01 -05:00
evazion ab5432d149 pundit: convert pools to pundit. 2020-03-20 18:03:01 -05:00
evazion 83eae1bf11 pundit: convert passwords to pundit. 2020-03-20 18:03:01 -05:00
evazion 62835ac9fc pundit: convert notes to pundit. 2020-03-20 18:03:01 -05:00
evazion 2c4c29b81a pundit: convert favorite groups to pundit. 2020-03-20 18:03:01 -05:00
evazion 50fa674a3e pundit: convert emails to pundit. 2020-03-20 18:03:01 -05:00
evazion a440c56ed8 pundit: convert comment votes to pundit. 2020-03-20 18:03:01 -05:00
evazion ce1133dd69 pundit: convert artist commentaries to pundit. 2020-03-20 18:03:01 -05:00
evazion 3d83c3154e pundit: convert forum topic visits to pundit. 2020-03-20 18:03:01 -05:00
evazion f1f489c40b pundit: convert favorites to pundit. 2020-03-20 18:03:01 -05:00
evazion cc2b4abd09 pundit: convert forum post votes to pundit. 2020-03-20 18:03:01 -05:00
evazion be59e85d25 pundit: convert ip addresses to pundit. 2020-03-20 18:03:01 -05:00
evazion 92aeb8728f pundit: convert ip bans to pundit. 2020-03-20 18:03:01 -05:00
evazion 9242bf522b pundit: convert moderation reports to pundit. 2020-03-20 18:03:01 -05:00
evazion 480f39c34a pundit: convert dmails to pundit. 2020-03-20 18:03:01 -05:00
evazion 15ba2f6cd7 tests: fix email delivery tests.
Setting deliver_later_queue_name inside config/application.rb broke
tests because assert_enqueued_email_with assumes that the deliver_later
queue is called `mailers`.
2020-03-20 18:03:00 -05:00
evazion 19817a6f85 pundit: convert modqueue to pundit. 2020-03-20 18:03:00 -05:00
evazion 3d72e62c77 pundit: convert bans to pundit. 2020-03-20 18:03:00 -05:00
evazion ff1d71af2e pundit: convert artists to pundit. 2020-03-20 18:03:00 -05:00
evazion 79a365abe0 pundit: convert bulk update requests to pundit. 2020-03-20 18:03:00 -05:00
evazion b83c612246 pundit: convert delayed jobs to pundit. 2020-03-20 18:03:00 -05:00
evazion 4a36b99614 pundit: convert tag aliases / implications to pundit. 2020-03-20 18:03:00 -05:00
evazion 4bb036aff1 pundit: convert tags to pundit. 2020-03-20 18:03:00 -05:00
evazion 4cd0b2cbfe pundit: convert user feedbacks to pundit.
Allow users to delete feedbacks they've given to other users, not just
mods.
2020-03-20 18:03:00 -05:00
evazion 565a6572a7 pundit: convert user name change requests to pundit.
Fix discrepancy between index action and show action. The index
action allowed members to see name changes for undeleted users, but the
show action didn't.
2020-03-20 18:03:00 -05:00
evazion db63b6d44f pundit: convert forum topics / forum posts to pundit.
Fix it being possible for users to delete or undelete their own forum
posts and topics, even if they were deleted by a mod.
2020-03-20 18:03:00 -05:00
evazion b3ff08fedf pundit: convert wiki pages to pundit. 2020-03-20 18:03:00 -05:00
evazion 5c6d26ea24 pundit: convert users to pundit. 2020-03-20 18:03:00 -05:00
evazion a0c4617057 pundit: convert comments to pundit. 2020-03-20 18:03:00 -05:00
evazion d8e4a26906 pundit: convert news updates to pundit. 2020-03-20 18:03:00 -05:00
evazion 1d16034144 pundit: add initial application policy. 2020-03-20 18:03:00 -05:00
evazion d10925eb95 post query builder: fix deprecated raw sql warning. 2020-03-20 17:55:08 -05:00
evazion bb9ee6e394 uploads: remove dead "Force update" link for mods. 2020-03-20 17:55:08 -05:00
evazion ca2d25c042 reltags: remove mark inactive button from artist urls.
In related tags, remove the (X) button next to artist urls for marking
them as inactive. This was broken because it didn't record the change
to the is_active flag in the artist history.
2020-03-20 17:55:08 -05:00
evazion 4d49bf053f tests: fix only param test. 2020-03-20 17:53:59 -05:00
evazion 8aac108e6b tests: fix password reset tests. 2020-03-20 17:53:59 -05:00
evazion 2d260f509d tests: remove upload tags test. 2020-03-20 16:33:00 -05:00
evazion c2b2349472 Merge pull request #4339 from BrokenEagle/version-reports
Add alternate version comparisons
2020-03-20 16:32:28 -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
evazion 31424ce545 twitter: add test for video thumbnails (#4262). 2020-03-20 16:19:07 -05:00
evazion 31ee88796c Merge pull request #4346 from BrokenEagle/fix-twitter-video-links
Allow video thumbnails as direct Twitter images
2020-03-20 16:17:15 -05:00
evazion 9a3b855cf6 bulk update requests: fix reference to title attribute.
Also remove non-nullable and default options from migration. The column
didn't originally have these options so they shouldn't be added if the
migration is reverted.
2020-03-20 16:08:20 -05:00
evazion 09f021daf7 Merge pull request #4341 from BrokenEagle/bur-fixes
Various BUR fixes
2020-03-20 15:58:27 -05:00
evazion 844bacb890 Merge pull request #4342 from BrokenEagle/fix-blacklist-with-children
Only count unique post IDs for blacklist menu
2020-03-20 15:48:01 -05:00
evazion f7175d3b12 emails: fix migrate emails fix script. 2020-03-18 15:11:32 -05:00
evazion e70eb0221e emails: fix deliver_later mails not being sent.
By default, mails sent by deliver_later are added to the `mailers` job
queue. These mails weren't being sent because workers were only
configured to process the `default` queue.
2020-03-18 15:10:59 -05:00
evazion d211264239 emails: add show endpoint. 2020-03-18 03:46:01 -05:00
evazion f34f740c54 Fix #4338: meta description of pools lists "pages" instead of "posts" 2020-03-18 03:38:12 -05:00
evazion 96085f17dd Fix #4334: db:migrate hangs.
Possible fix for #4334. Running fix scripts inside migrations is bad practice.
2020-03-18 03:32:40 -05:00
evazion ef43b276b3 Update ruby gems and yarn packages. 2020-03-18 03:31:45 -05:00
evazion c2360919c4 tests: fix parse_query test. 2020-03-18 03:09:14 -05:00
evazion 7d028f67e9 structure.sql: resynchronize. 2020-03-18 03:09:08 -05:00
evazion 8253df84d9 forum: make status labels into clickable filters.
* Make it so that you can click the stickied / locked / deleted icons or
  the new / approved / pending / rejected labels to filter topics by
  that status.

* Replace the `mod_only` search param with `is_private`.
2020-03-16 21:23:27 -05:00
evazion 95d65b25e2 forum: add back 'new' label, move status labels to right-side column.
Also prevent long usernames from wrapping.

Fixes #4332.
2020-03-16 21:22:27 -05:00
evazion 93a60eebed ip bans: forbid all non-GET actions for ip banned users.
Previously only actions that were marked member_only or above were
subject to IP ban restrictions. This meant that certain actions that
weren't marked member_only, like creating new accounts, could still be
done by IP banned users.

Now IP banned users can't do any non-GET actions, which means they're
not allowed to even login to their accounts.
2020-03-16 15:35:46 -05:00
evazion ea96295940 autocomplete: fix autocomplete returning empty tags.
Fix regression caused by 57ba5c59. Autocomplete implicitly relied on
Tag.search filtering out nonempty tags by default.
2020-03-16 15:35:08 -05:00
evazion 9389fee726 forum: fixup broken tests.
Fix tests broken by recent addition of BUR status indicators.
2020-03-16 14:33:52 -05:00
evazion 4b30e644bb Update ruby gems and yarn packages. 2020-03-14 21:17:58 -05:00
evazion 0f0e7cedf3 dmails: fixup exceptions when verifying dmail keys.
Fix show action throwing exceptions when viewing a dmail without a dmail key.
2020-03-14 21:09:25 -05:00
evazion dc1742321d dmails: send email notifications in background job. 2020-03-14 21:06:29 -05:00
evazion 0ef9d6e417 emails: send welcome mail on signup. 2020-03-14 19:18:28 -05:00
evazion d860fab7f5 emails: send verification mail when user changes address. 2020-03-14 18:32:00 -05:00
evazion 167fe51a8a emails: move edit email flow to emails controller. 2020-03-14 17:42:47 -05:00
evazion 3dbdce3ae3 mod reports: fix exception when reporting forum posts. 2020-03-12 21:23:57 -05:00
evazion 258f4a8b95 users: move emails to separate table.
* Move emails from users table to email_addresses table.
* Validate that addresses are formatted correctly and are unique across
  users. Existing invalid emails are grandfathered in.
* Add is_verified flag (the address has been confirmed by the user).
* Add is_deliverable flag (an undeliverable address is an address that bounces).
* Normalize addresses to prevent registering multiple accounts with the
  same email address (using tricks like Gmail's plus addressing).
2020-03-12 21:18:53 -05:00
evazion 41304d6add forum: fix topics with no BURs being marked as approved. 2020-03-11 21:54:17 -05:00
evazion cc2172a925 forum: fix exception in forum_topics/new.
Caused by including is_read? in html_data_attributes. updated_at is nil
for new topics.
2020-03-11 21:06:04 -05:00
evazion 1f20ac2665 tags: fix value_for regex. 2020-03-11 02:09:59 -05:00
evazion e81161bca5 forum: adjust BUR status label colors (again).
* Indicate unread topics in bold instead of with a "NEW" label.
* Use pills for labels.
2020-03-11 00:01:56 -05:00
evazion f917595554 forum: adjust BUR status label colors. 2020-03-10 23:11:41 -05:00
evazion 6fecf5db0e BURs: remove old single alias/implication pruning code.
* Rename TagChangeRequestPruner to BulkUpdateRequestPruner.
* Remove old code for pruning individual alias / implication requests.
2020-03-10 21:23:46 -05:00
evazion be585060f4 BURs: don't add [APPROVED] / [REJECTED] tags to titles. 2020-03-10 21:02:12 -05:00
evazion 0e7632ed8a aliases/implications: remove forum topic updating code.
Remove code for updating forum topics when an alias or implication is
approved or rejected. This code was only used when approving single
alias or implication requests. This is no longer used now that all
alias/implication requests are done through BURs.
2020-03-10 20:55:20 -05:00
evazion 6504d44223 forum: change BUR counts to status labels.
Use pending / approved / rejected status labels in front of the topic
title instead of a BUR count column. This is to make the forum listing
easier to visually scan for resolved vs unresolved topics.

Labels are only added for topics in the Tags category. This is a hack to
avoid labels on megathreads that have had BURs mistakenly attached to them.

[APPROVED] and [REJECTED] labels are stripped from thread titles to make
the titles cleaner. This is a hack until these titles can be fixed.
2020-03-10 20:13:11 -05:00
evazion 134a06722a forum: use icons to indicate sticky/locked/deleted/restricted status. 2020-03-10 19:04:56 -05:00
evazion 0317033d58 Revert "Return the actual sample size used for related tag calculations"
This reverts commit be0bb42ba9.
2020-03-09 22:18:57 -05:00
evazion cb11d818b1 artist versions: fixup is_active reference. 2020-03-09 14:40:22 -05:00
evazion f57f2bde08 Update ruby gems. 2020-03-08 23:18:15 -05:00
evazion 5625458f69 users: refactor password reset flow.
The old password reset flow:

* User requests a password reset.
* Danbooru generates a password reset nonce.
* Danbooru emails user a password reset confirmation link.
* User follows link to password reset confirmation page.
* The link contains a nonce authenticating the user.
* User confirms password reset.
* Danbooru resets user's password to a random string.
* Danbooru emails user their new password in plaintext.

The new password reset flow:

* User requests a password reset.
* Danbooru emails user a password reset link.
* User follows link to password edit page.
* The link contains a signed_user_id param authenticating the user.
* User changes their own password.
2020-03-08 23:18:15 -05:00
evazion f25bace766 users: refactor change password page.
* Fix users being redirected back to the change password page after
  successfully changing their password.
* Move passwords controller out of /maintenance/ namespace.
* Add tests.
2020-03-08 23:18:08 -05:00
evazion c30ba8d5bc users/edit: fix Advanced settings section being shown by default. 2020-03-08 14:24:38 -05:00
evazion f2d7e42d89 Merge pull request #4301 from BrokenEagle/forum-topic-bur-indicators
Add BUR counters to forum topics index
2020-03-07 23:04:19 -06:00
evazion a1ddba4929 Merge pull request #4325 from BrokenEagle/related-tag-enhancements
Related tag enhancements
2020-03-07 22:38:24 -06:00
evazion de0b8218b5 Merge pull request #4329 from BrokenEagle/update-blacklist-controls
Update blacklist controls
2020-03-07 22:32:47 -06:00
evazion 1a2c082b86 search: support negated wildcards in post searches.
* Support negated wildcards in searches (e.g. "holding -holding_*")
* Raise wildcard limit to matching 25 tags regardless of user level.
* Fix wildcards potentially matching empty tags.
* Fix wildcard tags being sorted by post count only, and therefore not
  having a stable ordering when tags have equal post counts.
* Fix sidebar to calculate wildcards tags the same way the search does.
2020-03-06 23:23:38 -06:00