discourse/spec
Blake Erickson 367de2594d
FIX: Unlike own posts on ownership transfer (#10446)
* FIX: Unlike own posts on ownership transfer

If a user has liked a post that has passed the
`post_undo_action_window_mins` system setting window and you transfer ownership
of that post to that user you will be the owner of a post that you have
liked, but cannot unlike resulting in a weird UI behavior. This commit
fixes this issue.

The existing tests didn't check for the timeout window for unliking
posts so I added that in.

I couldn't find a good way to do this logic inside of the guardian class
so rather than duplicating behavior of the `PostActionDestroyer` class
inside of the `PostOwnerChanger` I decided to pass in a "bypass"
variable that could be used to check if the calling class is the
'post_owner_changer' and bypass the guardian instead. I went this route
because the guardian `can_delete_post_action` method has no way of
distinguishing how to allow a user to be able to unlike their own posts
after the timeout window but only on a post owner change.

* use an options hash instead
2020-08-19 09:21:02 -06:00
..
components DEV: Bump rotp gem to latest version (#10472) 2020-08-19 09:16:33 -06:00
fabricators FIX: generate_topic_thumbnails job infinitely running for corrupted images 2020-08-13 17:08:32 -06:00
fixtures DEV: Plugins can extend color definitions (#10383) 2020-08-06 09:46:17 -04:00
helpers Add site setting to pick dark mode color scheme (#10390) 2020-08-07 08:52:47 -04:00
import_export FEATURE: Rake task to export groups (#9450) 2020-04-17 14:59:54 -07:00
initializers FIX: We need to skip users with associated reviewables when auto-approving (#9080) 2020-03-02 14:33:52 -05:00
integration DEV: Enable preserve_email_structure_when_styling by default 2020-07-20 10:21:32 +01:00
integrity DEV: Check English locale for errors in CI 2020-06-03 21:54:58 +02:00
jobs DEV: IMAP log to database (#10435) 2020-08-14 12:01:31 +10:00
lib DEV: Remove blob: workers from CSP (#10440) 2020-08-14 18:15:30 +01:00
mailers FIX: Exclude shared drafts from digests 2020-08-04 13:35:48 -04:00
models DEV: adds event_reminder (27) and event_invitation (28) (#10473) 2020-08-19 12:07:51 +02:00
multisite FIX: invalid urls should not break store.has_been_uploaded? 2020-06-25 15:00:15 +10:00
requests FIX: Unlike own posts on ownership transfer (#10446) 2020-08-19 09:21:02 -06:00
script/import_scripts FIX: Change base importer to create new Bookmark records (#9603) 2020-05-01 11:34:55 +10:00
serializers FIX: makes group_show_serializer#is_group_owner follow standards (#10466) 2020-08-18 18:30:08 +02:00
services FIX: Unlike own posts on ownership transfer (#10446) 2020-08-19 09:21:02 -06:00
support DEV: Improve docs for Sidekiq job assertion helpers. 2020-07-24 17:37:22 +08:00
tasks FEATURE: Add uploads:batch_migrate_from_s3 task to limit total posts migrated at once (#9933) 2020-06-04 09:48:11 +10:00
views/omniauth_callbacks FEATURE: Use full page redirection for all external auth methods (#8092) 2019-10-08 12:10:43 +01:00
rails_helper.rb Update rubocop to 2.3.1. 2020-07-24 17:19:21 +08:00
swagger_helper.rb DEV: Add rswag to aid in api documention (#9546) 2020-04-27 16:40:07 -06:00