mirror of https://github.com/vector-im/riot-web
Listen for additional reactions in existing collection
The various reaction UI bits will now listen for `Reactions.add` for new reactions just like with redactions. Part of https://github.com/vector-im/riot-web/issues/9572pull/21833/head
parent
37d2f60045
commit
39bd0d8bb3
|
@ -37,18 +37,24 @@ export default class ReactionDimension extends React.PureComponent {
|
|||
};
|
||||
|
||||
if (props.reactions) {
|
||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.reactions !== nextProps.reactions) {
|
||||
nextProps.reactions.on("Relations.add", this.onReactionsChange);
|
||||
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.props.reactions) {
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.add",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.redaction",
|
||||
this.onReactionsChange,
|
||||
|
|
|
@ -32,18 +32,24 @@ export default class ReactionsRow extends React.PureComponent {
|
|||
super(props);
|
||||
|
||||
if (props.reactions) {
|
||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.reactions !== nextProps.reactions) {
|
||||
nextProps.reactions.on("Relations.add", this.onReactionsChange);
|
||||
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.props.reactions) {
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.add",
|
||||
this.onReactionsChange,
|
||||
);
|
||||
this.props.reactions.removeListener(
|
||||
"Relations.redaction",
|
||||
this.onReactionsChange,
|
||||
|
|
Loading…
Reference in New Issue