-
-
Notifications
You must be signed in to change notification settings - Fork 600
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
Local echo for redactions #937
Conversation
Not ready for review yet, need to fix something with cancelling a redaction |
also re-aggregate the relation if it's redaction has been cancelled
Ok, ready for review now. |
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 working on this! 😁 I have a few questions about this, as these code paths are tricky to follow, so I'm watching out for complexity where we can.
src/models/room.js
Outdated
if (redactedEvent) { | ||
redactedEvent.unmarkLocallyRedacted(); | ||
// re-render after undoing redaction | ||
this.emit("Room.redaction", redactionEvent, this); |
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.
Would a different event be better, in case listeners want to take a separate action for undoing reactions? Or is there a way to distinguish the two from the args?
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.
Initially I added a boolean flag as the third parameter, but nothing would use it. Only the TimelinePanel
listens for Room.redaction
and it does a forceUpdate
, which is also what we do now on "unredaction". Seemed a bit artificial to add an event that calls the same event handler there, or duplicates it?
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.
Well, since the JS SDK has other consumer than just the React SDK, I wonder if others would want handle them differently...? (I have no idea.) I guess I am just thinking that if I were using this SDK in my app, I might be surprised by the same event be reused for the opposite action. Up to you though, maybe we just wait and see if hear it's a concern...?
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.
That is a fair point, I'll add a Room.redactionCancelled
event then.
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 improvements! 😁
element-hq/element-web#9675
Needs matrix-org/matrix-react-sdk#3058
reverting the local echo of a redaction on cancelling: