Skip to content

Commit

Permalink
fix(frontend): MkSubNoteContent.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Oct 4, 2023
1 parent 76e728b commit f7e7a4a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 32 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
# 릴리즈 노트
이 문서는 CherryPick의 변경 사항만 포함합니다.

## 4.x.x
출시일: unreleased<br>
기반 Misskey 버전: 2023.x.x<br>
Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGELOG.md#2023xx) 문서를 참고하십시오.

## NOTE
> 버전 관리 방식이 변경되었기 때문에, 기존 버전보다 낮은 것으로 인식되어 업데이트 대화 상자가 표시되지 않을 수 있습니다.
> 또한, 일부 locale이 누락되거나 기능이 정상적으로 작동하지 않는 등의 문제가 발생할 수 있습니다.
> 문제가 발생하면 '설정 - 캐시 비우기'를 진행하거나, 브라우저 캐시를 삭제하십시오.
### Client
- Fix: 서브 노트 기능 오류
- 서브 노트에서 더 보기 버튼을 사용할 수 없음
- 리액션 변경 기능을 사용할 수 없음

---

## 4.3.3 (Hotfix)
출시일: 2023/10/3<br>
기반 Misskey 버전: 2023.9.3<br>
Expand Down
89 changes: 57 additions & 32 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="note.myReaction == null" ref="heartReactButton" v-vibrate="[30, 50, 50]" v-tooltip="i18n.ts.like" :class="$style.footerButton" class="_button" @mousedown="heartReact()">
<i class="ti ti-heart"></i>
</button>
<button v-if="note.myReaction == null && note.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="[30, 50, 50]" v-tooltip="i18n.ts.reaction" :class="$style.footerButton" class="_button" @mousedown="react()">
<i class="ti ti-mood-plus"></i>
<button v-if="note.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="[30, 50, 50]" v-tooltip="i18n.ts.reaction" :class="$style.footerButton" class="_button" @mousedown="react()">
<i v-if="note.myReaction == null" class="ti ti-mood-plus"></i>
<i v-else class="ti ti-mood-edit"></i>
</button>
<button v-if="note.myReaction != null" ref="reactButton" v-vibrate="[30, 50, 50]" :class="$style.footerButton" class="_button" @click="undoReact(note)">
<i v-if="note.reactionAcceptance !== 'likeOnly'" class="ti ti-mood-minus"></i>
<i v-else class="ti ti-heart-minus"></i>
<button v-if="note.myReaction != null && note.reactionAcceptance == 'likeOnly'" ref="reactButton" v-vibrate="[30, 50, 50]" :class="$style.footerButton" class="_button" @click="undoReact(note)">
<i class="ti ti-heart-minus"></i>
</button>
<button v-if="canRenote && defaultStore.state.renoteQuoteButtonSeparation" v-vibrate="5" v-tooltip="i18n.ts.quote" class="_button" :class="$style.footerButton" @mousedown="quote()">
<i class="ti ti-quote"></i>
Expand Down Expand Up @@ -165,10 +165,29 @@ useNoteCapture({
isDeletedRef: isDeleted,
});

useTooltip(renoteButton, async (showing) => {
const renotes = await os.api('notes/renotes', {
noteId: props.note.id,
limit: 11,
});

const users = renotes.map(x => x.user);

if (users.length < 1) return;

os.popup(MkUsersTooltip, {
showing,
users,
count: props.note.renoteCount,
targetElement: renoteButton.value,
}, {}, 'closed');
});

function menu(viaKeyboard = false): void {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value }), menuButton.value, {
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value });
os.popupMenu(menu, menuButton.value, {
viaKeyboard,
}).then(focus);
}).then(focus).finally(cleanup);
}

async function clip() {
Expand All @@ -186,24 +205,6 @@ async function translate(): Promise<void> {
translation.value = res;
}

useTooltip(renoteButton, async (showing) => {
const renotes = await os.api('notes/renotes', {
noteId: props.note.id,
limit: 11,
});

const users = renotes.map(x => x.user);

if (users.length < 1) return;

os.popup(MkUsersTooltip, {
showing,
users,
count: props.note.renoteCount,
targetElement: renoteButton.value,
}, {}, 'closed');
});

function renote(viaKeyboard = false) {
pleaseLogin();
showMovedDialog();
Expand Down Expand Up @@ -370,19 +371,43 @@ function react(viaKeyboard = false): void {
} else {
blur();
reactionPicker.show(reactButton.value, reaction => {
os.api('notes/reactions/create', {
noteId: props.note.id,
reaction: reaction,
});
if (props.note.text && props.note.text.length > 100 && (Date.now() - new Date(props.note.createdAt).getTime() < 1000 * 3)) {
claimAchievement('reactWithoutRead');
}
toggleReaction(reaction);
}, () => {
focus();
});
}
}

async function toggleReaction(reaction) {
const oldReaction = note.myReaction;
if (oldReaction) {
const confirm = await os.confirm({
type: 'warning',
text: oldReaction !== reaction ? i18n.ts.changeReactionConfirm : i18n.ts.cancelReactionConfirm,
});
if (confirm.canceled) return;

os.api('notes/reactions/delete', {
noteId: note.id,
}).then(() => {
if (oldReaction !== reaction) {
os.api('notes/reactions/create', {
noteId: note.id,
reaction: reaction,
});
}
});
} else {
os.api('notes/reactions/create', {
noteId: appearNote.id,
reaction: reaction,
});
}
if (appearNote.text && appearNote.text.length > 100 && (Date.now() - new Date(appearNote.createdAt).getTime() < 1000 * 3)) {
claimAchievement('reactWithoutRead');
}
}

function heartReact(): void {
pleaseLogin();
showMovedDialog();
Expand Down

0 comments on commit f7e7a4a

Please sign in to comment.