[REGRESSION] Remove @ and # from mention (#1721)

This commit is contained in:
Diego Mello 2020-02-13 21:22:53 -03:00 committed by GitHub
parent 88c0ba6aff
commit 400d33250d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 19 deletions

View File

@ -4723,7 +4723,7 @@ exports[`Storyshots Message list message 1`] = `
]
}
>
@rocket.cat
rocket.cat
</Text>
<Text
numberOfLines={0}
@ -4766,7 +4766,7 @@ exports[`Storyshots Message list message 1`] = `
]
}
>
@diego.mello
diego.mello
</Text>
<Text
numberOfLines={0}
@ -4809,7 +4809,7 @@ exports[`Storyshots Message list message 1`] = `
]
}
>
@all
all
</Text>
<Text
numberOfLines={0}
@ -4852,7 +4852,7 @@ exports[`Storyshots Message list message 1`] = `
]
}
>
@here
here
</Text>
<Text
numberOfLines={0}
@ -4895,7 +4895,7 @@ exports[`Storyshots Message list message 1`] = `
]
}
>
#general
general
</Text>
</Text>
</View>

View File

@ -28,21 +28,27 @@ const AtMention = React.memo(({
}
const handlePress = () => {
if (mentions && mentions.length && mentions.findIndex(m => m.username === mention) !== -1) {
const index = mentions.findIndex(m => m.username === mention);
const navParam = {
t: 'd',
rid: mentions[index]._id
};
navToRoomInfo(navParam);
}
const index = mentions.findIndex(m => m.username === mention);
const navParam = {
t: 'd',
rid: mentions[index]._id
};
navToRoomInfo(navParam);
};
if (mentions && mentions.length && mentions.findIndex(m => m.username === mention) !== -1) {
return (
<Text
style={[preview ? { ...styles.text, color: themes[theme].bodyText } : mentionStyle, ...style]}
onPress={preview ? undefined : handlePress}
>
{mention}
</Text>
);
}
return (
<Text
style={[preview ? { ...styles.text, color: themes[theme].bodyText } : mentionStyle, ...style]}
onPress={preview ? undefined : handlePress}
>
<Text style={[styles.text, { color: themes[theme].bodyText }, ...style]}>
{`@${ mention }`}
</Text>
);

View File

@ -24,12 +24,12 @@ const Hashtag = React.memo(({
style={[preview ? { ...styles.text, color: themes[theme].bodyText } : styles.mention, ...style]}
onPress={preview ? undefined : handlePress}
>
{`#${ hashtag }`}
{hashtag}
</Text>
);
}
return (
<Text style={[preview ? { ...styles.text, color: themes[theme].bodyText } : styles.mention, ...style]}>
<Text style={[styles.text, { color: themes[theme].bodyText }, ...style]}>
{`#${ hashtag }`}
</Text>
);