summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-10-18 01:16:59 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-10-18 01:16:59 +0900
commit7413634734d31b4558a5fbaed01d8d2a88c20742 (patch)
tree345704fbc2d4bbf45631901dfa4d6b58dd6067a3 /src
parent:art: (diff)
downloadsharkey-7413634734d31b4558a5fbaed01d8d2a88c20742.tar.gz
sharkey-7413634734d31b4558a5fbaed01d8d2a88c20742.tar.bz2
sharkey-7413634734d31b4558a5fbaed01d8d2a88c20742.zip
リアクション一覧の公開をオプトインに
Diffstat (limited to 'src')
-rw-r--r--src/client/pages/settings/privacy.vue7
-rw-r--r--src/client/pages/user/index.vue4
-rw-r--r--src/models/entities/user-profile.ts5
-rw-r--r--src/models/repositories/user.ts1
-rw-r--r--src/server/api/endpoints/i/update.ts5
-rw-r--r--src/server/api/endpoints/users/reactions.ts14
6 files changed, 33 insertions, 3 deletions
diff --git a/src/client/pages/settings/privacy.vue b/src/client/pages/settings/privacy.vue
index 7756158578..2a60ae1f46 100644
--- a/src/client/pages/settings/privacy.vue
+++ b/src/client/pages/settings/privacy.vue
@@ -5,6 +5,10 @@
<FormSwitch v-model="autoAcceptFollowed" :disabled="!isLocked" @update:modelValue="save()">{{ $ts.autoAcceptFollowed }}</FormSwitch>
<template #caption>{{ $ts.lockedAccountInfo }}</template>
</FormGroup>
+ <FormSwitch v-model="publicReactions" @update:modelValue="save()">
+ {{ $ts.makeReactionsPublic }}
+ <template #desc>{{ $ts.makeReactionsPublicDescription }}</template>
+ </FormSwitch>
<FormSwitch v-model="hideOnlineStatus" @update:modelValue="save()">
{{ $ts.hideOnlineStatus }}
<template #desc>{{ $ts.hideOnlineStatusDescription }}</template>
@@ -64,6 +68,7 @@ export default defineComponent({
noCrawle: false,
isExplorable: false,
hideOnlineStatus: false,
+ publicReactions: false,
}
},
@@ -80,6 +85,7 @@ export default defineComponent({
this.noCrawle = this.$i.noCrawle;
this.isExplorable = this.$i.isExplorable;
this.hideOnlineStatus = this.$i.hideOnlineStatus;
+ this.publicReactions = this.$i.publicReactions;
},
mounted() {
@@ -94,6 +100,7 @@ export default defineComponent({
noCrawle: !!this.noCrawle,
isExplorable: !!this.isExplorable,
hideOnlineStatus: !!this.hideOnlineStatus,
+ publicReactions: !!this.publicReactions,
});
}
}
diff --git a/src/client/pages/user/index.vue b/src/client/pages/user/index.vue
index 6811dff2db..f74bf49883 100644
--- a/src/client/pages/user/index.vue
+++ b/src/client/pages/user/index.vue
@@ -270,12 +270,12 @@ export default defineComponent({
title: this.$ts.overview,
icon: 'fas fa-home',
onClick: () => { this.$router.push('/@' + getAcct(this.user)); },
- }, {
+ }, ...(this.$i && (this.$i.id === this.user.id)) || this.user.publicReactions ? [{
active: this.page === 'reactions',
title: this.$ts.reaction,
icon: 'fas fa-laugh',
onClick: () => { this.$router.push('/@' + getAcct(this.user) + '/reactions'); },
- }, {
+ }] : [], {
active: this.page === 'clips',
title: this.$ts.clips,
icon: 'fas fa-paperclip',
diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts
index a2da07d76f..1f450f223d 100644
--- a/src/models/entities/user-profile.ts
+++ b/src/models/entities/user-profile.ts
@@ -75,6 +75,11 @@ export class UserProfile {
})
public emailNotificationTypes: string[];
+ @Column('boolean', {
+ default: false,
+ })
+ public publicReactions: boolean;
+
@Column('varchar', {
length: 128, nullable: true,
})
diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts
index b6f27e32e2..2b77b613a8 100644
--- a/src/models/repositories/user.ts
+++ b/src/models/repositories/user.ts
@@ -231,6 +231,7 @@ export class UserRepository extends Repository<User> {
}),
pinnedPageId: profile!.pinnedPageId,
pinnedPage: profile!.pinnedPageId ? Pages.pack(profile!.pinnedPageId, me) : null,
+ publicReactions: profile!.publicReactions,
twoFactorEnabled: profile!.twoFactorEnabled,
usePasswordLessLogin: profile!.usePasswordLessLogin,
securityKeys: profile!.twoFactorEnabled
diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts
index 9dd637251d..3b8b1579ea 100644
--- a/src/server/api/endpoints/i/update.ts
+++ b/src/server/api/endpoints/i/update.ts
@@ -68,6 +68,10 @@ export const meta = {
validator: $.optional.bool,
},
+ publicReactions: {
+ validator: $.optional.bool,
+ },
+
carefulBot: {
validator: $.optional.bool,
},
@@ -180,6 +184,7 @@ export default define(meta, async (ps, _user, token) => {
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus;
+ if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions;
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
diff --git a/src/server/api/endpoints/users/reactions.ts b/src/server/api/endpoints/users/reactions.ts
index 44d7887482..fe5e4d84a9 100644
--- a/src/server/api/endpoints/users/reactions.ts
+++ b/src/server/api/endpoints/users/reactions.ts
@@ -1,9 +1,10 @@
import $ from 'cafy';
import { ID } from '@/misc/cafy-id';
import define from '../../define';
-import { NoteReactions } from '@/models/index';
+import { NoteReactions, UserProfiles } from '@/models/index';
import { makePaginationQuery } from '../../common/make-pagination-query';
import { generateVisibilityQuery } from '../../common/generate-visibility-query';
+import { ApiError } from '../../error';
export const meta = {
tags: ['users', 'reactions'],
@@ -48,10 +49,21 @@ export const meta = {
},
errors: {
+ reactionsNotPublic: {
+ message: 'Reactions of the user is not public.',
+ code: 'REACTIONS_NOT_PUBLIC',
+ id: '673a7dd2-6924-1093-e0c0-e68456ceae5c'
+ },
}
};
export default define(meta, async (ps, me) => {
+ const profile = await UserProfiles.findOneOrFail(ps.userId);
+
+ if (me == null || (me.id !== ps.userId && !profile.publicReactions)) {
+ throw new ApiError(meta.errors.reactionsNotPublic);
+ }
+
const query = makePaginationQuery(NoteReactions.createQueryBuilder('reaction'),
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere(`reaction.userId = :userId`, { userId: ps.userId })