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 m.replace relations #920

Merged
merged 15 commits into from
May 16, 2019

Conversation

bwindels
Copy link
Contributor

return this._clearEvent.content || this.event.content || {};
if (this._replacingEvent && !this.isRedacted()) {
return this._replacingEvent.getContent()["m.new_content"] || {};
// content = Object.assign({}, content, newContent);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assuming this gets removed later...

@@ -226,7 +226,12 @@ utils.extend(module.exports.MatrixEvent.prototype, {
* @return {Object} The event content JSON, or an empty object.
*/
getContent: function() {
return this._clearEvent.content || this.event.content || {};
if (this._replacingEvent && !this.isRedacted()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the redacted check here...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we don't want to return any replaced content for a redacted event. I guess a better way to do this would be to set this._replacingEvent to null in makeRedacted.

@@ -759,7 +759,7 @@ EventTimelineSet.prototype.aggregateRelations = function(event) {
}
}

relationsWithEventType.addEvent(event);
relationsWithEventType.addEvent(event, relatesToEvent);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add a separate setTargetEvent or similar to do this separately, and also ensure we only do it one time per relations collection (once the target event is found), as findEventById is not very efficient.

src/models/event.js Outdated Show resolved Hide resolved
call makeReplaced from addEvent instead so it's all done from Relations
as redaction supersedes a replacement
@bwindels bwindels requested a review from jryans May 16, 2019 14:56
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, this looks good to me! 😁

src/models/event-timeline-set.js Outdated Show resolved Hide resolved
src/models/relations.js Outdated Show resolved Hide resolved
@bwindels bwindels merged commit fbf5352 into develop May 16, 2019
@t3chguy t3chguy deleted the bwindels/message-editing-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