Skip to content

Commit

Permalink
漏れ?
Browse files Browse the repository at this point in the history
  • Loading branch information
hideki0403 authored and chan-mai committed Nov 15, 2024
1 parent bf51e6e commit 9007757
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 26 deletions.
36 changes: 18 additions & 18 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10574,24 +10574,6 @@ export interface Locale extends ILocale {
*/
"loop": string;
};
"_hideReactionCount": {
/**
* 非表示にしない
*/
"none": string;
/**
* 自分のノートのみ
*/
"self": string;
/**
* 自分以外のノートのみ
*/
"others": string;
/**
* 全てのノート
*/
"all": string;
};
"_profileHiddenSettings": {
/**
* プロフィールを非表示にする機能
Expand Down Expand Up @@ -10714,6 +10696,24 @@ export interface Locale extends ILocale {
*/
"codeGeneratedDescription": string;
};
"_hideReactionCount": {
/**
* 非表示にしない
*/
"none": string;
/**
* 自分のノートのみ
*/
"self": string;
/**
* 自分以外のノートのみ
*/
"others": string;
/**
* 全てのノート
*/
"all": string;
};
/**
* 予約投稿
*/
Expand Down
12 changes: 5 additions & 7 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ _delivery:
manuallySuspended: "手動停止中"
goneSuspended: "サーバー削除のため停止中"
autoSuspendedForNotResponding: "サーバー応答なしのため停止中"

selectReaction: "いいねボタンで使うリアクションを選択"
showLikeButton: "いいねボタンを表示する"

Expand Down Expand Up @@ -2813,12 +2812,6 @@ _mediaControls:
playbackRate: "再生速度"
loop: "ループ再生"

_hideReactionCount:
none: "非表示にしない"
self: "自分のノートのみ"
others: "自分以外のノートのみ"
all: "全てのノート"

_profileHiddenSettings:
hiddenProfile: "プロフィールを非表示にする機能"
hiddenPinnedNotes: "プロフィール上からピン留めしたノートを非表示にします"
Expand Down Expand Up @@ -2856,6 +2849,11 @@ _embedCodeGen:
generateCode: "埋め込みコードを作成"
codeGenerated: "コードが生成されました"
codeGeneratedDescription: "生成されたコードをウェブサイトに貼り付けてご利用ください。"
_hideReactionCount:
none: "非表示にしない"
self: "自分のノートのみ"
others: "自分以外のノートのみ"
all: "全てのノート"
schedulePost: "予約投稿"
schedulePostList: "予約投稿一覧"

11 changes: 10 additions & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.reactionTabs">
<button v-for="reaction in Object.keys(appearNote.reactions)" :key="reaction" :class="[$style.reactionTab, { [$style.reactionTabActive]: reactionTabType === reaction }]" class="_button" @click="reactionTabType = defaultStore.state.hideReactionUsers ? null : reaction">
<MkReactionIcon :reaction="reaction"/>
<span style="margin-left: 4px;">{{ appearNote.reactions[reaction] }}</span>
<span v-if="!hideReactionCount" style="margin-left: 4px;">{{ appearNote.reactions[reaction] }}</span>
</button>
</div>
<MkPagination v-if="reactionTabType" :key="reactionTabType" :pagination="reactionsPagination" :disableAutoLoad="true">
Expand Down Expand Up @@ -303,6 +303,15 @@ const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultS
const conversation = ref<Misskey.entities.Note[]>([]);
const replies = ref<Misskey.entities.Note[]>([]);
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<OpenOnRemoteOptions>(() => ({
type: 'lookup',
Expand Down
18 changes: 18 additions & 0 deletions packages/frontend/src/components/MkReactionsViewer.reaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,29 @@ const buttonEl = shallowRef<HTMLElement>();
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;

Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ watch([
showNoteActionsOnlyHover,
showGapBetweenNotesInTimeline,
instanceTicker,
hideReactionCount,
instanceIcon,
overridedDeviceKind,
mediaListWithOneImageAppearance,
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9007757

Please sign in to comment.