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

Support redactions and relations of/with unsent events. #947

Merged
merged 21 commits into from
Jun 13, 2019

Conversation

bwindels
Copy link
Contributor

@bwindels bwindels commented Jun 7, 2019

PR does several things to make this work:

  • fix scheduler assigning queue for redactions and relations
  • ensure queued relations and redactions to an unsent target have their local id replaced with a remote id before being sent:
    • have one method to return the related id for redactions and relations (getRelatedId) on Event
    • emit event on MatrixEvent once remote id is known
    • make the scheduler start sending a new event asynchronously, so the above code gets a chance to run before the next event is sent. (not entirely happy with this, we're relying on async implementation details that make this work, suggestions welcome)
  • preserve the locally redacted state when receiving the remote echo
  • don't re-add a locally redacted reaction when receiving remote echo

Hammering the react button now works as expected with local echo:
hammertime2

Part of: element-hq/element-web#9860
Fixes: element-hq/element-web#10034

@bwindels bwindels changed the title Support redactions and relations of/with unsent events. #946 Support redactions and relations of/with unsent events. Jun 7, 2019
@bwindels bwindels force-pushed the bwindels/relations-unsent branch 6 times, most recently from 5210826 to 10308a9 Compare June 11, 2019 09:15
@bwindels bwindels marked this pull request as ready for review June 12, 2019 08:14
@bwindels bwindels requested a review from a team June 12, 2019 08:14
@jryans jryans requested review from jryans and removed request for a team June 12, 2019 09:49
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 am particularly curious about the changes to redactions on remote echo, so I'd like to have another review for that bit.

Please note I am on holiday Thursday - Friday, so you may need a different reviewer if I am away when the next round appears.

spec/unit/scheduler.spec.js Outdated Show resolved Hide resolved
spec/unit/scheduler.spec.js Outdated Show resolved Hide resolved
src/client.js Show resolved Hide resolved
src/client.js Show resolved Hide resolved
spec/unit/scheduler.spec.js Outdated Show resolved Hide resolved
src/models/event.js Outdated Show resolved Hide resolved
src/models/event.js Outdated Show resolved Hide resolved
src/models/event.js Outdated Show resolved Hide resolved
src/models/room.js Outdated Show resolved Hide resolved
src/scheduler.js Show resolved Hide resolved
bwindels and others added 16 commits June 13, 2019 12:26
as they might need to wait until their target has been sent
before the next event is sent. This is needed to update the target id
if it was the local id of the event that was just sent.
in case the redacted event hasn't been sent yet
listeners shouldn't care about the original event, as it's removed
from the Relations collection already.
because the RedactionDimensions was trying to redact an event
that was already redacted after it's remote echo had come in
but it's redaction hadn't synced yet.
it'll cause the reactions counter to go up and down while reactions
and redactions come in.

In case the local redaction gets cancelled,
Room._revertRedactionLocalEcho will add the relation back to
the relations collection.
Co-Authored-By: J. Ryan Stinnett <[email protected]>
Co-Authored-By: J. Ryan Stinnett <[email protected]>
@bwindels bwindels requested a review from a team June 13, 2019 10:39
@bwindels
Copy link
Contributor Author

Thanks for working on this! I am particularly curious about the changes to redactions on remote echo, so I'd like to have another review for that bit.

Please note I am on holiday Thursday - Friday, so you may need a different reviewer if I am away when the next round appears.

Could someone have a second look as Ryan suggested? Thanks!

@dbkr dbkr requested review from dbkr and removed request for a team June 13, 2019 10:43
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense!

spec/unit/scheduler.spec.js Show resolved Hide resolved
@bwindels bwindels merged commit 26aab4f into develop Jun 13, 2019
@t3chguy t3chguy deleted the bwindels/relations-unsent 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.

local echo of redactions doesn't seem to honour rate limiting properly
3 participants