Skip to content

Commit

Permalink
feat: 고양이로 설정된 유저의 노트를 냥체를 표시하지 않고 볼 수 있음
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Nov 14, 2023
1 parent e7f2647 commit 6df1fe4
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
- Feat: 이모티콘 피커의 카테고리를 다중 계층 폴더로 분류할 수 있음 (misskey-dev/misskey#12132)
- Feat: 열람 주의로 설정된 미디어를 두 번 탭 하여 표시하도록 할 수 있음 #392
- Feat: 노트의 텍스트 소스를 볼 수 있음
- Feat: 고양이로 설정된 유저의 노트를 냥체를 표시하지 않고 볼 수 있음
- Enhance: 스와이프하여 타임라인을 다시 불러올 수 있음 (misskey-dev/misskey#12113)
- PC의 경우 오른쪽 상단의 버튼을 통해서도 다시 불러올 수 있습니다
- Enhance: 타임라인 자동 업데이트를 비활성화할 수 있음 (misskey-dev/misskey#12113)
Expand Down
2 changes: 2 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
_lang_: "English"
noNyaization: "Show content without Nyaization"
revertNoNyaization: "Reflect Nyaization settings"
viewTextSource: "View text source"
disableNoteEditConfirm: "Really continue editing the note?"
disableNoteEditConfirmWarn: "Only software that supports note editing<small>(Mastodon, CherryPick, FireFish, etc.)</small> will be able to see the edits and history.\nSoftware that doesn't support note editing will only show what was in the note before you edited it, so if you want it to reflect your edits across all federated servers, rewrite the note with <b>\"delete and edit\"</b>."
Expand Down
2 changes: 2 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Do not edit this file directly.
export interface Locale {
"_lang_": string;
"noNyaization": string;
"revertNoNyaization": string;
"viewTextSource": string;
"disableNoteEditConfirm": string;
"disableNoteEditConfirmWarn": string;
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
_lang_: "日本語"

noNyaization: "ニャ化を使わずに表示"
revertNoNyaization: "ニャ化の設定を反映する"
viewTextSource: "テキストのソースを表示する"
disableNoteEditConfirm: "ノート編集を続行しますか?"
disableNoteEditConfirmWarn: "ノート編集に対応しているソフトウェア<small>(Mastodon、CherryPick、FireFishなど)</small>でのみ、編集された内容と履歴を見ることができます。\nノート編集に対応していないソフトウェアでは、ノートを編集する前の内容が表示されるので、すべての連合サーバーで修正した内容を反映させたい場合は、<b>「削除して編集」</b>でノートを書き直してください。"
Expand Down
2 changes: 2 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
_lang_: "한국어"
noNyaization: "냥체를 사용하지 않고 표시"
revertNoNyaization: "냥체 설정 반영하기"
viewTextSource: "텍스트 소스 보기"
disableNoteEditConfirm: "노트 편집을 계속 진행할까요?"
disableNoteEditConfirmWarn: "노트 편집을 대응하는 소프트웨어<small>(Mastodon, CherryPick, FireFish 등)</small>에서만 편집된 내용과 이력을 볼 수 있어요.\n노트 편집이 지원되지 않는 소프트웨어에서는 노트를 편집하기 전의 내용으로 표시되므로, 모든 연합된 서버에서 수정된 내용을 반영하고 싶은 경우, <b>'삭제 후 편집'</b>으로 노트를 재작성해 주세요."
Expand Down
9 changes: 5 additions & 4 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div style="container-type: inline-size;">
<MkEvent v-if="appearNote.event" :note="appearNote"/>
<p v-if="appearNote.cw != null" :class="$style.cw">
<Mfm v-if="appearNote.cw != ''" :text="appearNote.cw" :author="appearNote.user" :nyaize="'account'"/>
<Mfm v-if="appearNote.cw != ''" :text="appearNote.cw" :author="appearNote.user" :nyaize="noNyaize ? false : 'account'"/>
<MkCwButton v-model="showContent" :note="appearNote" style="margin: 4px 0;"/>
</p>
<div v-show="appearNote.cw == null || showContent" :class="[{ [$style.contentCollapsed]: collapsed }]">
Expand All @@ -81,7 +81,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:parsedNodes="parsed"
:text="appearNote.text"
:author="appearNote.user"
:nyaize="'account'"
:nyaize="noNyaize ? false : 'account'"
:emojiUrls="appearNote.emojis"
:enableEmojiMenu="true"
:enableEmojiMenuReaction="true"
Expand Down Expand Up @@ -293,6 +293,7 @@ const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref<any>(null);
const translating = ref(false);
const viewTextSource = ref(false);
const noNyaize = ref(false);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || (appearNote.visibility === 'followers' && appearNote.userId === $i.id));
let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId || $i.id === appearNote.userId)) || (appearNote.myReaction != null)));

Expand Down Expand Up @@ -531,7 +532,7 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, menuButton, isDeleted, currentClip: currentClip?.value });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, noNyaize, menuButton, isDeleted, currentClip: currentClip?.value });
os.contextMenu(menu, ev).then(focus).finally(cleanup);
}
}
Expand All @@ -541,7 +542,7 @@ function menu(viaKeyboard = false): void {
return;
}

const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, menuButton, isDeleted, currentClip: currentClip?.value });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, noNyaize, menuButton, isDeleted, currentClip: currentClip?.value });
os.popupMenu(menu, menuButton.value, {
viaKeyboard,
}).then(focus).finally(cleanup);
Expand Down
9 changes: 5 additions & 4 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.noteContent">
<MkEvent v-if="appearNote.event" :note="appearNote"/>
<p v-if="appearNote.cw != null" :class="$style.cw">
<Mfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'account'"/>
<Mfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="noNyaize ? false : 'account'"/>
<MkCwButton v-model="showContent" :note="appearNote"/>
</p>
<div v-show="appearNote.cw == null || showContent">
Expand All @@ -100,7 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:parsedNodes="parsed"
:text="appearNote.text"
:author="appearNote.user"
:nyaize="'account'"
:nyaize="noNyaize ? false : 'account'"
:emojiUrls="appearNote.emojis"
:enableEmojiMenu="true"
:enableEmojiMenuReaction="true"
Expand Down Expand Up @@ -353,6 +353,7 @@ const isDeleted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref(null);
const translating = ref(false);
const noNyaize = ref(false);
const parsed = appearNote.text ? mfm.parse(appearNote.text) : null;
const urls = parsed ? extractUrlFromMfm(parsed) : null;
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance);
Expand Down Expand Up @@ -564,13 +565,13 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, noNyaize, menuButton, isDeleted });
os.contextMenu(menu, ev).then(focus).finally(cleanup);
}
}

function menu(viaKeyboard = false): void {
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, noNyaize, menuButton, isDeleted });
os.popupMenu(menu, menuButton.value, {
viaKeyboard,
}).then(focus).finally(cleanup);
Expand Down
6 changes: 4 additions & 2 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:parsedNodes="parsed"
:text="note.text"
:author="note.user"
:nyaize="'account'"
:nyaize="noNyaize ? false : 'account'"
:emojiUrls="note.emojis"
:enableEmojiMenu="true"
:enableEmojiMenuReaction="true"
Expand Down Expand Up @@ -165,6 +165,8 @@ const showContent = ref(true);
const translation = ref<any>(null);
const translating = ref(false);

const noNyaize = ref(false);

const parsed = props.note.text ? mfm.parse(props.note.text) : null;

const isLong = shouldCollapsed(props.note, []);
Expand Down Expand Up @@ -368,7 +370,7 @@ function menu(viaKeyboard = false): void {
return;
}

const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, noNyaize, menuButton, isDeleted, currentClip: currentClip?.value });
os.popupMenu(menu, menuButton.value, {
viaKeyboard,
}).then(focus).finally(cleanup);
Expand Down
18 changes: 18 additions & 0 deletions packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export function getNoteMenu(props: {
translation: Ref<any>;
translating: Ref<boolean>;
viewTextSource: Ref<boolean>;
noNyaize: Ref<boolean>;
isDeleted: Ref<boolean>;
currentClip?: Misskey.entities.Clip;
}) {
Expand Down Expand Up @@ -316,6 +317,14 @@ export function getNoteMenu(props: {
props.viewTextSource.value = true;
}

function noNyaizeText(): void {
props.noNyaize.value = true;
}

function revertNoNyaizeText(): void {
props.noNyaize.value = false;
}

let menu: MenuItem[];
if ($i) {
const statePromise = os.api('notes/state', {
Expand Down Expand Up @@ -381,6 +390,15 @@ export function getNoteMenu(props: {
text: i18n.ts.viewTextSource,
action: showViewTextSource,
},
props.noNyaize.value ? {
icon: 'ti ti-cat',
text: i18n.ts.revertNoNyaization,
action: revertNoNyaizeText,
} : {
icon: 'ti ti-cat',
text: i18n.ts.noNyaization,
action: noNyaizeText,
},
null,
statePromise.then(state => state.isFavorited ? {
icon: 'ti ti-star-off',
Expand Down

0 comments on commit 6df1fe4

Please sign in to comment.