Commit Graph

18 Commits

Author SHA1 Message Date
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
Krzysztof Kotlarek
427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Robin Ward
b58867b6e9 FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API
backwards compatibility.

Co-Authored-By: romanrizzi <romanalejandro@gmail.com>
Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
2019-03-28 12:45:10 -04:00
Régis Hanol
b284464a91 FIX: PostOwnerChange should update 'topic.last_poser' 2018-05-16 19:48:04 +02:00
Maja Komel
3d99726981 FIX: set notification level when changing post owner (#5616)
FIX: do not notify last post editor if they mention themself
2018-04-16 11:48:06 +02:00
Gerhard Schlager
80e85e0d8f FIX: Sidekiq job has wrong data when post owner changes within transaction 2018-03-01 18:00:18 +01:00
Gerhard Schlager
a7c50039de FIX: Allow changing post owner even when topic validations fail 2018-03-01 17:31:58 +01:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Bianca Nenciu
117417848e Remove like on change of ownership. (#5038) 2017-08-11 09:55:00 +02:00
Arpit Jalan
a590f35982 FEATURE: allow changing post owners without creating post revision 2016-08-19 23:34:21 +05:30
Robin Ward
83e46cc302 FIX: Restrict changing ownership to one topic 2016-06-17 14:20:14 -04:00
Kane York
acbf82d8db FIX: Change post owner of deleted post, take 3 2015-07-21 16:43:52 -07:00
Kane York
61ea8c6f72 FIX: Allow to change ownership on deleted users' posts 2015-07-15 15:29:35 -07:00
Kane York
8796760825 FIX: Allow changing ownership of posts with deleted users 2015-07-14 21:15:34 -07:00
Sam
c6a5081763 FEATURE: reorder participants in topic so always chronological
FEATURE: tie breaker for same number of posts is last post date
UX: highlight for latest poster when it is OP
2015-04-06 17:27:05 +10:00
Neil Lalonde
dece5a351a more fixes for post ownership change and user deletion 2015-03-11 15:54:20 -04:00
Neil Lalonde
1bf4f34049 FIX: topic and post counts are not updated when ownership of a post is changed 2015-03-02 12:13:21 -05:00