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) {
|
if (props.reactions) {
|
||||||
|
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.reactions !== nextProps.reactions) {
|
if (this.props.reactions !== nextProps.reactions) {
|
||||||
|
nextProps.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.props.reactions) {
|
if (this.props.reactions) {
|
||||||
|
this.props.reactions.removeListener(
|
||||||
|
"Relations.add",
|
||||||
|
this.onReactionsChange,
|
||||||
|
);
|
||||||
this.props.reactions.removeListener(
|
this.props.reactions.removeListener(
|
||||||
"Relations.redaction",
|
"Relations.redaction",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
|
|
|
@ -32,18 +32,24 @@ export default class ReactionsRow extends React.PureComponent {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
if (props.reactions) {
|
if (props.reactions) {
|
||||||
|
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.reactions !== nextProps.reactions) {
|
if (this.props.reactions !== nextProps.reactions) {
|
||||||
|
nextProps.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.props.reactions) {
|
if (this.props.reactions) {
|
||||||
|
this.props.reactions.removeListener(
|
||||||
|
"Relations.add",
|
||||||
|
this.onReactionsChange,
|
||||||
|
);
|
||||||
this.props.reactions.removeListener(
|
this.props.reactions.removeListener(
|
||||||
"Relations.redaction",
|
"Relations.redaction",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
|
|
Loading…
Reference in New Issue