Skip to content
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

Merged
merged 11 commits into from
Jun 5, 2019
Merged

Local echo for redactions #937

merged 11 commits into from
Jun 5, 2019

Conversation

bwindels
Copy link
Contributor

@bwindels bwindels commented Jun 3, 2019

element-hq/element-web#9675

Needs matrix-org/matrix-react-sdk#3058

redact-local-echo

reverting the local echo of a redaction on cancelling:
local-echo-redaction-relation

@bwindels
Copy link
Contributor Author

bwindels commented Jun 3, 2019

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
@bwindels
Copy link
Contributor Author

bwindels commented Jun 4, 2019

Ok, ready for review now.

@bwindels bwindels requested a review from a team June 4, 2019 10:32
@jryans jryans requested review from jryans and removed request for a team June 4, 2019 11:42
Copy link
Collaborator

@jryans jryans left a 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/base-apis.js Outdated Show resolved Hide resolved
src/client.js Outdated Show resolved Hide resolved
src/models/event.js Show resolved Hide resolved
src/models/room.js Outdated Show resolved Hide resolved
src/models/room.js Outdated Show resolved Hide resolved
src/models/room.js Outdated Show resolved Hide resolved
if (redactedEvent) {
redactedEvent.unmarkLocallyRedacted();
// re-render after undoing redaction
this.emit("Room.redaction", redactionEvent, this);
Copy link
Collaborator

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?

Copy link
Contributor Author

@bwindels bwindels Jun 4, 2019

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?

Copy link
Collaborator

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...?

Copy link
Contributor Author

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.

src/models/event.js Outdated Show resolved Hide resolved
@bwindels bwindels requested a review from jryans June 4, 2019 14:10
Copy link
Collaborator

@jryans jryans left a 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! 😁

@bwindels bwindels requested a review from jryans June 4, 2019 16:45
@bwindels bwindels merged commit 1bc9ee7 into develop Jun 5, 2019
@t3chguy t3chguy deleted the bwindels/redactions-local-echo branch May 10, 2022 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants