MM-28450 Fix crash when posting at-mention that does not belong to the channel (#4778)

This commit is contained in:
Elias Nahum
2020-09-08 16:52:04 -03:00
committed by GitHub
parent e40d0e4c8a
commit 05f264554e

View File

@@ -141,9 +141,9 @@ export default class AtMention extends React.PureComponent {
render() {
const {isSearchResult, mentionName, mentionStyle, onPostPress, teammateNameDisplay, textStyle, mentionKeys} = this.props;
const {user} = this.state;
const {backgroundColor, ...styleText} = StyleSheet.flatten(textStyle);
const mentionTextStyle = [];
let backgroundColor;
let canPress = false;
let highlighted;
let isMention = false;
@@ -152,6 +152,13 @@ export default class AtMention extends React.PureComponent {
let onPress;
let suffix;
let suffixElement;
let styleText;
if (textStyle) {
const {backgroundColor: bg, ...otherStyles} = StyleSheet.flatten(textStyle);
backgroundColor = bg;
styleText = otherStyles;
}
if (user?.username) {
suffix = this.props.mentionName.substring(user.username.length);