-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(1.x,approval): correct PostWasApproved
event trigger condition
#3925
Conversation
Ensure the PostWasApproved event is only raised for posts that are not hidden. This fixes the issue where the event was incorrectly triggered for hidden posts. Additionally, the post's approval status is set to true upon deletion to remove any pending approval status.
I have noticed a problem (not introduced in this PR) with hiding discussions. When a post is hidden, the discussion is left empty. I will add a fix to this PR. |
…ng discussions for unapproved initial posts Introduces the PostWasUnapproved event, fired upon every post unapproval. Specifically, when the unapproved post is the initial post of a discussion, this event also hides the entire discussion. This change ensures that unapproved initial posts do not leave their discussions visible on the forum.
PostWasApproved
event trigger conditionPostWasApproved
event trigger condition and introduce PostWasUnapproved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I have dived into the issue to understand the flow, and the main problem is that the PostWasApproved
event is triggered always when hiding or restoring a post, regardless of actual approval status/action. Which does not make sense. If I am listening to the post approval even, I expect that there was a state change from approved
to unapproved
. But right now even if you hide any approved post, the event is triggered.
The changes here seem close but based on testing I feel this is closer to what we would want: bed386f
What do you think?
I don't understand the second commit though:
- When the first post is hidden and the discussion is empty, the entire discussion is hidden away from other users so I don't think we need to change anything about it.
- The PostWasUnpproved even is identical to the Hidden event in terms of when it is triggered so a bit redundant.
I thought everyone could see the discussion without any post: 2023-11-10.11-31-02.mp4Now I see that other users except the admin and the author don't see it.
Maybe so, but it is more specific and can be useful in some cases such as here: https://github.com/flarum/framework/pull/3925/files#diff-dd866324feaa8087e4ee73330d8affaf8352fd52dde6ca007a837e49179957e7R27 |
I'm afraid it only seems to add more confusion, because the reason the Also hiding != unapproving thought the two are already confusing right now |
hiding != unapproving but unapproving = hiding so it's more specific and can be useful in cases where someone wants to listen for a post unapproval event only |
there is no unapproving. You can only change |
…ts, hiding discussions for unapproved initial posts" This reverts commit 3bbd1f7.
Co-authored-by: SychO9 <[email protected]>
I have reverted the commit that added the |
PostWasApproved
event trigger condition and introduce PostWasUnapproved
PostWasApproved
event trigger condition
@rafaucau that's the plan, I should be able to get around to it today |
PostWasApproved
event trigger conditionPostWasApproved
event trigger condition
PostWasApproved
event trigger conditionPostWasApproved
event trigger condition
Fixes #3921
Changes proposed in this pull request:
Ensure the
PostWasApproved
event is only raised for posts that are not hidden and introduce thePostWasUnapproved
event to handle scenarios where a post is unapproved, particularly when it's the first post and the discussion needs to be hidden as a result.QA
Necessity
Confirmed