mirror of https://github.com/vector-im/riot-web
Merge pull request #2981 from matrix-org/jryans/reactions-status-bar
Listen for removed relationspull/21833/head
commit
88bee3363c
|
@ -37,6 +37,7 @@ export default class ReactionDimension extends React.PureComponent {
|
||||||
|
|
||||||
if (props.reactions) {
|
if (props.reactions) {
|
||||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
|
props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +45,7 @@ export default class ReactionDimension extends React.PureComponent {
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (prevProps.reactions !== this.props.reactions) {
|
if (prevProps.reactions !== this.props.reactions) {
|
||||||
this.props.reactions.on("Relations.add", this.onReactionsChange);
|
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.props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
this.onReactionsChange();
|
this.onReactionsChange();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +57,10 @@ export default class ReactionDimension extends React.PureComponent {
|
||||||
"Relations.add",
|
"Relations.add",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
);
|
);
|
||||||
|
this.props.reactions.removeListener(
|
||||||
|
"Relations.remove",
|
||||||
|
this.onReactionsChange,
|
||||||
|
);
|
||||||
this.props.reactions.removeListener(
|
this.props.reactions.removeListener(
|
||||||
"Relations.redaction",
|
"Relations.redaction",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
|
@ -107,7 +113,7 @@ export default class ReactionDimension extends React.PureComponent {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
return reactions.getAnnotationsBySender()[userId];
|
return [...reactions.getAnnotationsBySender()[userId].values()];
|
||||||
}
|
}
|
||||||
|
|
||||||
onOptionClick = (ev) => {
|
onOptionClick = (ev) => {
|
||||||
|
|
|
@ -34,6 +34,7 @@ export default class ReactionsRow extends React.PureComponent {
|
||||||
|
|
||||||
if (props.reactions) {
|
if (props.reactions) {
|
||||||
props.reactions.on("Relations.add", this.onReactionsChange);
|
props.reactions.on("Relations.add", this.onReactionsChange);
|
||||||
|
props.reactions.on("Relations.remove", this.onReactionsChange);
|
||||||
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ export default class ReactionsRow extends React.PureComponent {
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (prevProps.reactions !== this.props.reactions) {
|
if (prevProps.reactions !== this.props.reactions) {
|
||||||
this.props.reactions.on("Relations.add", this.onReactionsChange);
|
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.props.reactions.on("Relations.redaction", this.onReactionsChange);
|
||||||
this.onReactionsChange();
|
this.onReactionsChange();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +58,10 @@ export default class ReactionsRow extends React.PureComponent {
|
||||||
"Relations.add",
|
"Relations.add",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
);
|
);
|
||||||
|
this.props.reactions.removeListener(
|
||||||
|
"Relations.remove",
|
||||||
|
this.onReactionsChange,
|
||||||
|
);
|
||||||
this.props.reactions.removeListener(
|
this.props.reactions.removeListener(
|
||||||
"Relations.redaction",
|
"Relations.redaction",
|
||||||
this.onReactionsChange,
|
this.onReactionsChange,
|
||||||
|
@ -80,7 +86,7 @@ export default class ReactionsRow extends React.PureComponent {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
return reactions.getAnnotationsBySender()[userId];
|
return [...reactions.getAnnotationsBySender()[userId].values()];
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in New Issue