fix(frontend): Unicode絵文字とカスタム絵文字の名前が重複したときにカスタム絵文字がオートコンプリートにサジェストされない問題を修正
This commit is contained in:
parent
f6af6d9679
commit
67195245c1
|
@ -59,6 +59,7 @@
|
|||
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
|
||||
- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正
|
||||
- Fix: 連合なしの状態の読み書きができない問題を修正
|
||||
- Fix: Unicode絵文字とカスタム絵文字の名前が重複したときにカスタム絵文字がオートコンプリートにサジェストされない問題を修正
|
||||
|
||||
### Server
|
||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||
|
|
|
@ -25,7 +25,7 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
// 完全一致(エイリアスなし)
|
||||
emojiDb.some(x => {
|
||||
if (x.name === query && !x.aliasOf) {
|
||||
matched.set(x.name, { emoji: x, score: query.length + 3 });
|
||||
matched.set(x.emoji, { emoji: x, score: query.length + 3 });
|
||||
}
|
||||
return matched.size === max;
|
||||
});
|
||||
|
@ -33,8 +33,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
// 完全一致(エイリアス込み)
|
||||
if (matched.size < max) {
|
||||
emojiDb.some(x => {
|
||||
if (x.name === query && !matched.has(x.aliasOf ?? x.name)) {
|
||||
matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length + 2 });
|
||||
if (x.name === query && !matched.has(x.emoji)) {
|
||||
matched.set(x.emoji, { emoji: x, score: query.length + 2 });
|
||||
}
|
||||
return matched.size === max;
|
||||
});
|
||||
|
@ -43,8 +43,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
// 前方一致(エイリアスなし)
|
||||
if (matched.size < max) {
|
||||
emojiDb.some(x => {
|
||||
if (x.name.startsWith(query) && !x.aliasOf && !matched.has(x.name)) {
|
||||
matched.set(x.name, { emoji: x, score: query.length + 1 });
|
||||
if (x.name.startsWith(query) && !x.aliasOf && !matched.has(x.emoji)) {
|
||||
matched.set(x.emoji, { emoji: x, score: query.length + 1 });
|
||||
}
|
||||
return matched.size === max;
|
||||
});
|
||||
|
@ -53,8 +53,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
// 前方一致(エイリアス込み)
|
||||
if (matched.size < max) {
|
||||
emojiDb.some(x => {
|
||||
if (x.name.startsWith(query) && !matched.has(x.aliasOf ?? x.name)) {
|
||||
matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length });
|
||||
if (x.name.startsWith(query) && !matched.has(x.emoji)) {
|
||||
matched.set(x.emoji, { emoji: x, score: query.length });
|
||||
}
|
||||
return matched.size === max;
|
||||
});
|
||||
|
@ -63,8 +63,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
// 部分一致(エイリアス込み)
|
||||
if (matched.size < max) {
|
||||
emojiDb.some(x => {
|
||||
if (x.name.includes(query) && !matched.has(x.aliasOf ?? x.name)) {
|
||||
matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length - 1 });
|
||||
if (x.name.includes(query) && !matched.has(x.emoji)) {
|
||||
matched.set(x.emoji, { emoji: x, score: query.length - 1 });
|
||||
}
|
||||
return matched.size === max;
|
||||
});
|
||||
|
@ -87,8 +87,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
}
|
||||
|
||||
// 半分以上の文字が含まれていればヒットとする
|
||||
if (hit > Math.ceil(queryChars.length / 2) && hit - 2 > (matched.get(x.aliasOf ?? x.name)?.score ?? 0)) {
|
||||
hitEmojis.set(x.aliasOf ?? x.name, { emoji: x, score: hit - 2 });
|
||||
if (hit > Math.ceil(queryChars.length / 2) && hit - 2 > (matched.get(x.emoji)?.score ?? 0)) {
|
||||
hitEmojis.set(x.emoji, { emoji: x, score: hit - 2 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue