Skip to content

Commit

Permalink
fix(frontend): 사용자 제안 중 @를 입력하면 제안 결과가 사라질 수 있음 (misskey-dev/misske…
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Feb 17, 2025
2 parents 3a582ab + a6c5cfa commit 0896712
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2025xx](CHANGE
- 개행만으로 메시지를 보낼 수 있음
- 이 변경으로 더 이상 첫 줄에 개행을 입력할 수 없게 됩니다.
- Fix: `모든 리노트 간략화하기` 설정이 타임라인 헤더 메뉴에 표시되지 않음
- Fix: 사용자 제안 중 `@`를 입력하면 제안 결과가 사라질 수 있음 (misskey-dev/misskey#14385)

---

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ function exec() {
users.value = JSON.parse(cache);
fetching.value = false;
} else {
const [username, host] = props.q.toString().split('@');
misskeyApi('users/search-by-username-and-host', {
username: props.q,
username: username,
host: host,
limit: 10,
detail: false,
}).then(searchedUsers => {
Expand Down
10 changes: 8 additions & 2 deletions packages/frontend/src/scripts/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ export class Autocomplete {
let opened = false;

if (isMention && this.onlyType.includes('user')) {
const username = text.substring(mentionIndex + 1);
if (username !== '' && username.match(/^[a-zA-Z0-9_]+$/)) {
// ユーザのサジェスト中に@を入力すると、その位置から新たにユーザ名を取りなおそうとしてしまう
// この動きはリモートユーザのサジェストを阻害するので、@を検知したらその位置よりも前の@を探し、
// ホスト名を含むリモートのユーザ名を全て拾えるようにする
const mentionIndexAlt = text.lastIndexOf('@', mentionIndex - 1);
const username = mentionIndexAlt === -1
? text.substring(mentionIndex + 1)
: text.substring(mentionIndexAlt + 1);
if (username !== '' && username.match(/^[a-zA-Z0-9_@.]+$/)) {
this.open('user', username);
opened = true;
} else if (username === '') {
Expand Down

0 comments on commit 0896712

Please sign in to comment.