discourse/lib/guardian
Ted Johansson 96b725a11c
FIX: Don't allow editing own posts user can no longer see (#30839)
In a PM, if a user has made a post, and is later removed from the PM, they can still edit their own post. This can be done either if they happen to have a composer open in an active tab, or by just manually sending an HTTP request.

The post guardian is missing a basic check, can_see_post_topic? when we determine whether a user can edit a post or not. This basic check is already in place when we determine whether a user can see the post in the first place.

This PR adds in the missing check, so that if the user tries to edit their post after being removed, they'll receive a 403.

It also adds a MessageBus message scoped to the affected user and topic when they are removed from the PM, which will redirect them to their inbox. This helps avoid a stale tab where they are still in the PM which they by right can now no longer see.
2025-01-20 10:09:58 +08:00
..
bookmark_guardian.rb FEATURE: Promote polymorphic bookmarks to default and migrate (#16729) 2022-05-23 10:07:15 +10:00
category_guardian.rb FEATURE: improve the suppression for admins when required (#29041) 2024-10-02 10:52:02 +10:00
ensure_magic.rb DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
flag_guardian.rb FIX: limit the number of custom flags to 50 (#28221) 2024-08-06 10:50:12 +10:00
group_guardian.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
post_guardian.rb FIX: Don't allow editing own posts user can no longer see (#30839) 2025-01-20 10:09:58 +08:00
post_revision_guardian.rb FEATURE: Allow admins to permanently delete revisions (#19913) 2023-01-19 15:09:01 -06:00
sidebar_guardian.rb DEV: specs to ensure that only admin can edit Community section (#21666) 2023-05-23 10:54:55 +10:00
tag_guardian.rb DEV: Remove TagGuardian#can_create_tag? fallback (#25535) 2024-02-02 13:48:53 +08:00
topic_guardian.rb FEATURE: improve the suppression for admins when required (#29041) 2024-10-02 10:52:02 +10:00
user_guardian.rb FEATURE: allow disabling of anti spam profile hiding feature (#30508) 2024-12-31 15:04:53 +11:00