Fix hashtag shortcut added check

This commit is contained in:
Lim Chee Aun 2023-04-09 00:46:30 +08:00
parent 7edf63d41b
commit 5b2cbc5bf1

View file

@ -260,6 +260,7 @@ function Hashtags(props) {
const shortcut = { const shortcut = {
type: 'hashtag', type: 'hashtag',
hashtag: hashtags.join(' '), hashtag: hashtags.join(' '),
instance,
}; };
// Check if already exists // Check if already exists
const exists = states.shortcuts.some( const exists = states.shortcuts.some(
@ -272,7 +273,8 @@ function Hashtags(props) {
shortcut.hashtag shortcut.hashtag
.split(/[\s+]+/) .split(/[\s+]+/)
.sort() .sort()
.join(' '), .join(' ') &&
(s.instance ? s.instance === shortcut.instance : true),
); );
if (exists) { if (exists) {
alert('This shortcut already exists'); alert('This shortcut already exists');