mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
Listen for removed relations
The JS SDK has learned how to remove relations when cancelled, so we should also listen for those as well. Part of https://github.com/vector-im/riot-web/issues/9731
This commit is contained in:
parent
2e7e71556b
commit
e942939be9
2 changed files with 12 additions and 0 deletions
|
@ -37,6 +37,7 @@ export default class ReactionDimension extends React.PureComponent {
|
|||
|
||||
if (props.reactions) {
|
||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +45,7 @@ export default class ReactionDimension extends React.PureComponent {
|
|||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.reactions !== this.props.reactions) {
|
||||
this.props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
this.props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||
this.props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
this.onReactionsChange();
|
||||
}
|
||||
|
@ -55,6 +57,10 @@ export default class ReactionDimension extends React.PureComponent {
|
|||
"Relations.add",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.remove",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.redaction",
|
||||
this.onReactionsChange,
|
||||
|
|
|
@ -34,6 +34,7 @@ export default class ReactionsRow extends React.PureComponent {
|
|||
|
||||
if (props.reactions) {
|
||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
|
||||
|
@ -45,6 +46,7 @@ export default class ReactionsRow extends React.PureComponent {
|
|||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.reactions !== this.props.reactions) {
|
||||
this.props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
this.props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||
this.props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
this.onReactionsChange();
|
||||
}
|
||||
|
@ -56,6 +58,10 @@ export default class ReactionsRow extends React.PureComponent {
|
|||
"Relations.add",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.remove",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.redaction",
|
||||
this.onReactionsChange,
|
||||
|
|
Loading…
Reference in a new issue