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/9572
This commit is contained in:
parent
37d2f60045
commit
39bd0d8bb3
2 changed files with 12 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue