From 9d1fa3f20259cf7c303d49d5aae8e1fecdafc7ed Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Nov 2020 16:49:23 +0900 Subject: [PATCH] =?UTF-8?q?autoWatch=E6=A9=9F=E8=83=BD=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 -- migration/1604821689616-delete-auto-watch.ts | 14 ++++++++++++++ src/client/pages/settings/notifications.vue | 15 --------------- src/models/entities/user-profile.ts | 5 ----- src/models/repositories/user.ts | 1 - src/server/api/endpoints/i/update.ts | 8 -------- src/server/api/endpoints/notes/polls/vote.ts | 10 +--------- src/services/note/create.ts | 13 ------------- src/services/note/polls/vote.ts | 10 +--------- src/services/note/reaction/create.ts | 11 +---------- 10 files changed, 17 insertions(+), 72 deletions(-) create mode 100644 migration/1604821689616-delete-auto-watch.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 5b16e3571..75b4b803d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -373,8 +373,6 @@ unregister: "登録を解除" passwordLessLogin: "パスワード無しログイン" resetPassword: "パスワードをリセット" newPasswordIs: "新しいパスワードは「{password}」です" -autoNoteWatch: "ノートの自動ウォッチ" -autoNoteWatchDescription: "あなたがリアクションしたり返信したりした他のユーザーのノートに関する通知を受け取るようにします。" reduceUiAnimation: "UIのアニメーションを減らす" share: "共有" notFound: "見つかりません" diff --git a/migration/1604821689616-delete-auto-watch.ts b/migration/1604821689616-delete-auto-watch.ts new file mode 100644 index 000000000..e47a4cf1d --- /dev/null +++ b/migration/1604821689616-delete-auto-watch.ts @@ -0,0 +1,14 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class deleteAutoWatch1604821689616 implements MigrationInterface { + name = 'deleteAutoWatch1604821689616' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "autoWatch"`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" ADD "autoWatch" boolean NOT NULL DEFAULT false`); + } + +} diff --git a/src/client/pages/settings/notifications.vue b/src/client/pages/settings/notifications.vue index 0b709a504..ff0c27639 100644 --- a/src/client/pages/settings/notifications.vue +++ b/src/client/pages/settings/notifications.vue @@ -3,15 +3,6 @@
{{ $t('notificationSetting') }}
-
-
-
- - {{ $t('autoNoteWatch') }} - -
-
-
{{ $t('markAsReadAllNotifications') }} {{ $t('markAsReadAllUnreadNotes') }} @@ -52,12 +43,6 @@ export default defineComponent({ }, methods: { - onChangeAutoWatch(v) { - os.api('i/update', { - autoWatch: v - }); - }, - readAllUnreadNotes() { os.api('i/read-all-unread-notes'); }, diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 7195c20ff..bd37da5ec 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -106,11 +106,6 @@ export class UserProfile { }) public room: Record; - @Column('boolean', { - default: false, - }) - public autoWatch: boolean; - @Column('boolean', { default: false, }) diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 4ac7c6d85..a33419683 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -235,7 +235,6 @@ export class UserRepository extends Repository { ...(opts.detail && meId === user.id ? { avatarId: user.avatarId, bannerId: user.bannerId, - autoWatch: profile!.autoWatch, injectFeaturedNote: profile!.injectFeaturedNote, alwaysMarkNsfw: profile!.alwaysMarkNsfw, carefulBot: profile!.carefulBot, diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 2029f2b4b..d3a8e0a8c 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -120,13 +120,6 @@ export const meta = { } }, - autoWatch: { - validator: $.optional.bool, - desc: { - 'ja-JP': '投稿の自動ウォッチをするか否か' - } - }, - injectFeaturedNote: { validator: $.optional.bool, }, @@ -212,7 +205,6 @@ export default define(meta, async (ps, user, token) => { if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot; if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed; if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat; - if (typeof ps.autoWatch === 'boolean') profileUpdates.autoWatch = ps.autoWatch; if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote; if (typeof ps.alwaysMarkNsfw === 'boolean') profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw; diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index 45210b5a6..1e6ab472c 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -1,6 +1,5 @@ import $ from 'cafy'; import { ID } from '../../../../../misc/cafy-id'; -import watch from '../../../../../services/note/watch'; import { publishNoteStream } from '../../../../../services/stream'; import { createNotification } from '../../../../../services/create-notification'; import define from '../../../define'; @@ -10,7 +9,7 @@ import { deliver } from '../../../../../queue'; import { renderActivity } from '../../../../../remote/activitypub/renderer'; import renderVote from '../../../../../remote/activitypub/renderer/vote'; import { deliverQuestionUpdate } from '../../../../../services/note/polls/update'; -import { PollVotes, NoteWatchings, Users, Polls, UserProfiles } from '../../../../../models'; +import { PollVotes, NoteWatchings, Users, Polls } from '../../../../../models'; import { Not } from 'typeorm'; import { IRemoteUser } from '../../../../../models/entities/user'; import { genId } from '../../../../../misc/gen-id'; @@ -152,13 +151,6 @@ export default define(meta, async (ps, user) => { } }); - const profile = await UserProfiles.findOne(user.id).then(ensure); - - // この投稿をWatchする - if (profile.autoWatch !== false) { - watch(user.id, note); - } - // リモート投票の場合リプライ送信 if (note.userHost != null) { const pollOwner = await Users.findOne(note.userId).then(ensure) as IRemoteUser; diff --git a/src/services/note/create.ts b/src/services/note/create.ts index c8e3db540..f6593996e 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -5,7 +5,6 @@ import renderNote from '../../remote/activitypub/renderer/note'; import renderCreate from '../../remote/activitypub/renderer/create'; import renderAnnounce from '../../remote/activitypub/renderer/announce'; import { renderActivity } from '../../remote/activitypub/renderer'; -import watch from './watch'; import { parse } from '../../mfm/parse'; import { resolveUser } from '../../remote/resolve-user'; import config from '../../config'; @@ -340,18 +339,11 @@ export default async (user: User, data: Option, silent = false) => new Promise new Promise { } }); - const profile = await UserProfiles.findOne(user.id); - - // ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする - if (Users.isLocalUser(user) && profile!.autoWatch) { - watch(user.id, note); - } - //#region 配信 if (Users.isLocalUser(user) && !note.localOnly) { const content = renderActivity(await renderLike(inserted, note));