You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
null checks added
This commit is contained in:
@ -831,14 +831,14 @@ export default class RoomView extends React.Component<IProps, IState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private handleEffects = (ev) => {
|
private handleEffects = (ev) => {
|
||||||
if (this.state.room.getUnreadNotificationCount() === 0) return;
|
if (!this.state.room ||
|
||||||
if (this.state.matrixClientIsReady) {
|
!this.state.matrixClientIsReady ||
|
||||||
effects.forEach(effect => {
|
this.state.room.getUnreadNotificationCount() === 0) return;
|
||||||
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
|
effects.forEach(effect => {
|
||||||
dis.dispatch({action: `effects.${effect.command}`});
|
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
|
||||||
}
|
dis.dispatch({action: `effects.${effect.command}`});
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
private onRoomName = (room: Room) => {
|
private onRoomName = (room: Room) => {
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
* @param {Array<string>} emojis The list of emojis to check for
|
* @param {Array<string>} emojis The list of emojis to check for
|
||||||
*/
|
*/
|
||||||
export const containsEmoji = (content: { msgtype: string, body: string }, emojis: Array<string>): boolean => {
|
export const containsEmoji = (content: { msgtype: string, body: string }, emojis: Array<string>): boolean => {
|
||||||
return emojis.some((emoji) => content.body.includes(emoji));
|
return emojis.some((emoji) => content.body && content.body.includes(emoji));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user