From 9007757dcde4e2ed21f32b66c52b1b1ad20bb111 Mon Sep 17 00:00:00 2001
From: yukineko <27853966+hideki0403@users.noreply.github.com>
Date: Fri, 12 Apr 2024 17:30:53 +0900
Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E3=82=8C=EF=BC=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
locales/index.d.ts | 36 +++++++++----------
locales/ja-JP.yml | 12 +++----
.../src/components/MkNoteDetailed.vue | 11 +++++-
.../components/MkReactionsViewer.reaction.vue | 18 ++++++++++
.../frontend/src/pages/settings/general.vue | 1 +
packages/frontend/src/store.ts | 4 +++
6 files changed, 56 insertions(+), 26 deletions(-)
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 2b12b264a940..cf3cbb09e84e 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -10574,24 +10574,6 @@ export interface Locale extends ILocale {
*/
"loop": string;
};
- "_hideReactionCount": {
- /**
- * 非表示にしない
- */
- "none": string;
- /**
- * 自分のノートのみ
- */
- "self": string;
- /**
- * 自分以外のノートのみ
- */
- "others": string;
- /**
- * 全てのノート
- */
- "all": string;
- };
"_profileHiddenSettings": {
/**
* プロフィールを非表示にする機能
@@ -10714,6 +10696,24 @@ export interface Locale extends ILocale {
*/
"codeGeneratedDescription": string;
};
+ "_hideReactionCount": {
+ /**
+ * 非表示にしない
+ */
+ "none": string;
+ /**
+ * 自分のノートのみ
+ */
+ "self": string;
+ /**
+ * 自分以外のノートのみ
+ */
+ "others": string;
+ /**
+ * 全てのノート
+ */
+ "all": string;
+ };
/**
* 予約投稿
*/
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 6227eb07a943..dad669656547 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -1342,7 +1342,6 @@ _delivery:
manuallySuspended: "手動停止中"
goneSuspended: "サーバー削除のため停止中"
autoSuspendedForNotResponding: "サーバー応答なしのため停止中"
-
selectReaction: "いいねボタンで使うリアクションを選択"
showLikeButton: "いいねボタンを表示する"
@@ -2813,12 +2812,6 @@ _mediaControls:
playbackRate: "再生速度"
loop: "ループ再生"
-_hideReactionCount:
- none: "非表示にしない"
- self: "自分のノートのみ"
- others: "自分以外のノートのみ"
- all: "全てのノート"
-
_profileHiddenSettings:
hiddenProfile: "プロフィールを非表示にする機能"
hiddenPinnedNotes: "プロフィール上からピン留めしたノートを非表示にします"
@@ -2856,6 +2849,11 @@ _embedCodeGen:
generateCode: "埋め込みコードを作成"
codeGenerated: "コードが生成されました"
codeGeneratedDescription: "生成されたコードをウェブサイトに貼り付けてご利用ください。"
+_hideReactionCount:
+ none: "非表示にしない"
+ self: "自分のノートのみ"
+ others: "自分以外のノートのみ"
+ all: "全てのノート"
schedulePost: "予約投稿"
schedulePostList: "予約投稿一覧"
diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue
index 578b800caffa..cbf2d30fbce4 100644
--- a/packages/frontend/src/components/MkNoteDetailed.vue
+++ b/packages/frontend/src/components/MkNoteDetailed.vue
@@ -180,7 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@@ -303,6 +303,15 @@ const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultS
const conversation = ref([]);
const replies = ref([]);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
+const hideReactionCount = computed(() => {
+ switch (defaultStore.state.hideReactionCount) {
+ case 'none': return false;
+ case 'all': return true;
+ case 'self': return props.note.userId === $i?.id;
+ case 'others': return props.note.userId !== $i?.id;
+ default: return false;
+ }
+});
const pleaseLoginContext = computed(() => ({
type: 'lookup',
diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue
index 65348bd249c1..ed18446f2668 100644
--- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue
+++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue
@@ -56,11 +56,29 @@ const buttonEl = shallowRef();
const emojiName = computed(() => props.reaction.replace(/:/g, '').replace(/@\./, ''));
const emoji = computed(() => customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction));
+function getReactionName(reaction: string, formated = false) {
+ const r = reaction.replaceAll(':', '').replace(/@.*/, '');
+ return formated ? `:${r}:` : r;
+}
+
+const isLocal = computed(() => !props.reaction.match(/@\w/));
+const isAvailable = computed(() => isLocal.value ? true : customEmojisMap.has(getReactionName(props.reaction)));
+
const canToggle = computed(() => {
return isAvailable.value && $i && emoji.value && checkReactionPermissions($i, props.note, emoji.value);
});
const canGetInfo = computed(() => !props.reaction.match(/@\w/) && props.reaction.includes(':'));
+const hideReactionCount = computed(() => {
+ switch (defaultStore.state.hideReactionCount) {
+ case 'none': return false;
+ case 'all': return true;
+ case 'self': return props.note.userId === $i?.id;
+ case 'others': return props.note.userId !== $i?.id;
+ default: return false;
+ }
+});
+
async function toggleReaction() {
if (!canToggle.value) return;
diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue
index dd37b0f21e11..50d095e4e40c 100644
--- a/packages/frontend/src/pages/settings/general.vue
+++ b/packages/frontend/src/pages/settings/general.vue
@@ -449,6 +449,7 @@ watch([
showNoteActionsOnlyHover,
showGapBetweenNotesInTimeline,
instanceTicker,
+ hideReactionCount,
instanceIcon,
overridedDeviceKind,
mediaListWithOneImageAppearance,
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index 6fd888115025..e9b84bacb9fb 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -436,6 +436,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account',
default: false,
},
+ hideReactionCount: {
+ where: 'account',
+ default: 'none' as 'none' | 'self' | 'others' | 'all',
+ },
limitWidthOfReaction: {
where: 'device',
default: true,