Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 誰がリアクションをしたのかを非表示にできる機能を実装 + fix: クエリの修正 #35

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- TL上のサーバー情報をアイコン表示に切り替えられるように https://github.com/team-shahu/misskey/pull/13 https://github.com/team-shahu/misskey/pull/24
- 特定のロールにのみお知らせを発行する機能 https://github.com/team-shahu/misskey/pull/18
- リアクションした人一覧がブロック・ミュートを考慮するようにする設定 https://github.com/team-shahu/misskey/pull/23 https://github.com/team-shahu/misskey/pull/27
- 誰がリアクションをしたのかを非表示にできる機能 https://github.com/hideki0403/kakurega.app/commit/65d85bb4fe724dc0737f1ac7958bc13c96cc926d

## Special Thanks
- [Misskey](https://github.com/misskey-dev/misskey)
Expand Down
5 changes: 4 additions & 1 deletion packages/backend/src/server/api/endpoints/notes/reactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@
this.cacheService.userBlockedCache.get(me.id),
]);

query.andWhere('reaction.userId NOT IN (:...userIds)', { userIds: Array.from(userIdsWhoMeMuting ?? []).concat(Array.from(userIdsWhoBlockingMe ?? [])) });
const userIds = Array.from(userIdsWhoMeMuting ?? []).concat(Array.from(userIdsWhoBlockingMe ?? []));
if (userIds.length > 0 ){

Check failure on line 76 in packages/backend/src/server/api/endpoints/notes/reactions.ts

View workflow job for this annotation

GitHub Actions / lint (backend)

Missing space before opening brace
query.andWhere('reaction.userId NOT IN (:...userIds)', { userIds: Array.from(userIdsWhoMeMuting ?? []).concat(Array.from(userIdsWhoBlockingMe ?? [])) });
}
}

if (ps.type) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div v-else-if="tab === 'reactions'" :class="$style.tab_reactions">
<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 = reaction">
<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>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkReactionIcon :reaction="reaction" :class="$style.reactionIcon" :noStyle="true"/>
<div :class="$style.reactionName">{{ getReactionName(reaction) }}</div>
</div>
<div :class="$style.users">
<div v-if="users.length" :class="$style.users">
<div v-for="u in users" :key="u.id" :class="$style.user">
<MkAvatar :class="$style.avatar" :user="u"/>
<MkUserName :user="u" :nowrap="true"/>
Expand Down Expand Up @@ -57,7 +57,6 @@ function getReactionName(reaction: string): string {

.reaction {
max-width: 100px;
padding-right: 10px;
text-align: center;
border-right: solid 0.5px var(--MI_THEME-divider);
}
Expand All @@ -81,6 +80,8 @@ function getReactionName(reaction: string): string {
margin: -4px 14px 0 10px;
font-size: 0.95em;
text-align: left;
padding-left: 10px;
border-left: solid 0.5px var(--divider);
}

.user {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ if (!mock) {
useTooltip(buttonEl, async (showing) => {
const useGet = !reactionChecksMuting.value;
const apiCall = useGet ? misskeyApiGet : misskeyApi;
const reactions = await apiCall('notes/reactions', {
const reactions = !defaultStore.state.hideReactionUsers ? await apiCall('notes/reactions', {
noteId: props.note.id,
type: props.reaction,
limit: 10,
_cacheKey_: props.count,
});
}) : [];

const users = reactions.map(x => x.user);
const count = users.length;
Expand Down
14 changes: 14 additions & 0 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="large">{{ i18n.ts.large }}</option>
</MkRadios>
<MkSwitch v-model="limitWidthOfReaction">{{ i18n.ts.limitWidthOfReaction }}</MkSwitch>
<MkSelect v-model="hideReactionCount">
<template #label>{{ i18n.ts.hideReactionCount }}<span class="_beta">{{ i18n.ts.originalFeature }}</span></template>
<option value="none">{{ i18n.ts._hideReactionCount.none }}</option>
<option value="self">{{ i18n.ts._hideReactionCount.self }}</option>
<option value="others">{{ i18n.ts._hideReactionCount.others }}</option>
<option value="all">{{ i18n.ts._hideReactionCount.all }}</option>
</MkSelect>
<MkSwitch v-model="hideReactionUsers">
<template #caption>{{ i18n.ts.hideReactionUsersDescription }}</template>
{{ i18n.ts.hideReactionUsers }}
<span class="_beta">{{ i18n.ts.originalFeature }}</span>
</MkSwitch>
</div>

<MkSelect v-model="instanceTicker">
Expand Down Expand Up @@ -296,6 +308,8 @@ const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNot
const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showClipButtonInNoteFooter'));
const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize'));
const limitWidthOfReaction = computed(defaultStore.makeGetterSetter('limitWidthOfReaction'));
const hideReactionCount = computed(defaultStore.makeGetterSetter('hideReactionCount'));
const hideReactionUsers = computed(defaultStore.makeGetterSetter('hideReactionUsers'));
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
const collapseRenotesTrigger = computed(defaultStore.makeGetterSetter('collapseRenotesTrigger'));
const collapseSelfRenotes = computed(defaultStore.makeGetterSetter('collapseSelfRenotes'));
Expand Down
8 changes: 8 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: 'medium' as 'small' | 'medium' | 'large',
},
hideReactionCount: {
where: 'account',
default: 'none' as 'none' | 'self' | 'others' | 'all',
},
hideReactionUsers: {
where: 'account',
default: false,
},
limitWidthOfReaction: {
where: 'device',
default: true,
Expand Down
Loading