diff --git a/package.json b/package.json index 142c9f12d59b..10b2630542a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2023.10.1-kakurega.1.20.0", + "version": "2023.10.1-kakurega.1.20.1", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/server/api/endpoints/following/update.ts b/packages/backend/src/server/api/endpoints/following/update.ts index c20dbfb6c49b..6ef88f7d2122 100644 --- a/packages/backend/src/server/api/endpoints/following/update.ts +++ b/packages/backend/src/server/api/endpoints/following/update.ts @@ -118,57 +118,79 @@ export default class extends Endpoint { // eslint- throw err; }); - // To subscribe - if (ps.notify === 'normal') { - // Check if already subscribing - const exist = await this.noteNotificationRepository.findOneBy({ - userId: me.id, - targetUserId: target.id, - }); - - if (exist != null) { - throw new ApiError(meta.errors.alreadySubscribing); - } - - // Check if blocking - if (await this.userBlockingService.checkBlocked(me.id, target.id)) { - throw new ApiError(meta.errors.blocking); - } - - // Check if blocked - if (await this.userBlockingService.checkBlocked(target.id, me.id)) { - throw new ApiError(meta.errors.blocked); + // フォローしているかどうかに関わらず、ノート通知の設定だけは変更できるようにする + if (ps.notify != null) { + // To subscribe + if (ps.notify === 'normal') { + // Check if already subscribing + const exist = await this.noteNotificationRepository.findOneBy({ + userId: me.id, + targetUserId: target.id, + }); + + if (exist != null) { + throw new ApiError(meta.errors.alreadySubscribing); + } + + // Check if blocking + if (await this.userBlockingService.checkBlocked(me.id, target.id)) { + throw new ApiError(meta.errors.blocking); + } + + // Check if blocked + if (await this.userBlockingService.checkBlocked(target.id, me.id)) { + throw new ApiError(meta.errors.blocked); + } + + // Create + const noteNotification = await this.noteNotificationRepository.insert({ + id: this.idService.genId(), + createdAt: new Date(), + userId: me.id, + targetUserId: target.id, + }).then(x => this.noteNotificationRepository.findOneByOrFail(x.identifiers[0])); + + // Publish event + this.globalEventService.publishInternalEvent('noteNotificationCreated', noteNotification); + } else { + // Check if already unsubscribed + const noteNotification = await this.noteNotificationRepository.findOneBy({ + userId: me.id, + targetUserId: target.id, + }); + + if (!noteNotification) { + throw new ApiError(meta.errors.alreadyUnsubscribed); + } + + // Delete + await this.noteNotificationRepository.delete({ + userId: me.id, + targetUserId: target.id, + }); + + // Publish event + this.globalEventService.publishInternalEvent('noteNotificationDeleted', noteNotification); } + } - // Create - const noteNotification = await this.noteNotificationRepository.insert({ - id: this.idService.genId(), - createdAt: new Date(), - userId: me.id, - targetUserId: target.id, - }).then(x => this.noteNotificationRepository.findOneByOrFail(x.identifiers[0])); - - // Publish event - this.globalEventService.publishInternalEvent('noteNotificationCreated', noteNotification); - } else { - // Check if already unsubscribed - const noteNotification = await this.noteNotificationRepository.findOneBy({ - userId: me.id, - targetUserId: target.id, + // withRepliesはフォローしている場合のみ変更できる + if (ps.withReplies != null) { + // Check not following + const exist = await this.followingsRepository.findOneBy({ + followerId: follower.id, + followeeId: target.id, }); - if (!noteNotification) { - throw new ApiError(meta.errors.alreadyUnsubscribed); + if (exist == null) { + throw new ApiError(meta.errors.notFollowing); } - // Delete - await this.noteNotificationRepository.delete({ - userId: me.id, - targetUserId: target.id, + await this.followingsRepository.update({ + id: exist.id, + }, { + withReplies: ps.withReplies, }); - - // Publish event - this.globalEventService.publishInternalEvent('noteNotificationDeleted', noteNotification); } return await this.userEntityService.pack(follower.id, me); diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 8b7604f311a2..39ac39993408 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -22,6 +22,7 @@ "@rollup/plugin-json": "6.0.1", "@rollup/plugin-replace": "5.0.3", "@rollup/pluginutils": "5.0.5", + "@sentry/vue": "^7.74.0", "@syuilo/aiscript": "0.16.0", "@tabler/icons-webfont": "2.37.0", "@vitejs/plugin-vue": "4.4.0", diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 8b4af40d5d25..e5fcdf6ffb87 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -4,6 +4,7 @@ */ import { computed, createApp, watch, markRaw, version as vueVersion, defineAsyncComponent, App } from 'vue'; +import * as Sentry from '@sentry/vue'; import { compareVersions } from 'compare-versions'; import widgets from '@/widgets/index.js'; import directives from '@/directives/index.js'; @@ -253,6 +254,13 @@ export async function common(createVue: () => App) { const app = createVue(); + if (!_DEV_) { + Sentry.init({ + app, + dsn: 'https://4787e38fa976cc8ffc3b9348fb96a2e1@sentry.yukineko.dev/2', + }); + } + if (_DEV_) { app.config.performance = true; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5466d7b20889..3eed2b7eb2e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -658,6 +658,9 @@ importers: '@rollup/pluginutils': specifier: 5.0.5 version: 5.0.5(rollup@4.0.2) + '@sentry/vue': + specifier: ^7.74.0 + version: 7.74.0(vue@3.3.4) '@syuilo/aiscript': specifier: 0.16.0 version: 0.16.0 @@ -5361,6 +5364,73 @@ packages: string-argv: 0.3.1 dev: true + /@sentry-internal/tracing@7.74.0: + resolution: {integrity: sha512-JK6IRGgdtZjswGfaGIHNWIThffhOHzVIIaGmglui+VFIzOsOqePjoxaDV0MEvzafxXZD7eWqGE5RGuZ0n6HFVg==} + engines: {node: '>=8'} + dependencies: + '@sentry/core': 7.74.0 + '@sentry/types': 7.74.0 + '@sentry/utils': 7.74.0 + tslib: 2.6.2 + dev: false + + /@sentry/browser@7.74.0: + resolution: {integrity: sha512-Njr8216Z1dFUcl6NqBOk20dssK9SjoVddY74Xq+Q4p3NfXBG3lkMcACXor7SFoJRZXq8CZWGS13Cc5KwViRw4g==} + engines: {node: '>=8'} + dependencies: + '@sentry-internal/tracing': 7.74.0 + '@sentry/core': 7.74.0 + '@sentry/replay': 7.74.0 + '@sentry/types': 7.74.0 + '@sentry/utils': 7.74.0 + tslib: 2.6.2 + dev: false + + /@sentry/core@7.74.0: + resolution: {integrity: sha512-83NRuqn7nDZkSVBN5yJQqcpXDG4yMYiB7TkYUKrGTzBpRy6KUOrkCdybuKk0oraTIGiGSe5WEwCFySiNgR9FzA==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.74.0 + '@sentry/utils': 7.74.0 + tslib: 2.6.2 + dev: false + + /@sentry/replay@7.74.0: + resolution: {integrity: sha512-GoYa3cHTTFVI/J1cnZ0i4X128mf/JljaswO3PWNTe2k3lSHq/LM5aV0keClRvwM0W8hlix8oOTT06nnenOUmmw==} + engines: {node: '>=12'} + dependencies: + '@sentry/core': 7.74.0 + '@sentry/types': 7.74.0 + '@sentry/utils': 7.74.0 + dev: false + + /@sentry/types@7.74.0: + resolution: {integrity: sha512-rI5eIRbUycWjn6s6o3yAjjWtIvYSxZDdnKv5je2EZINfLKcMPj1dkl6wQd2F4y7gLfD/N6Y0wZYIXC3DUdJQQg==} + engines: {node: '>=8'} + dev: false + + /@sentry/utils@7.74.0: + resolution: {integrity: sha512-k3np8nuTPtx5KDODPtULfFln4UXdE56MZCcF19Jv6Ljxf+YN/Ady1+0Oi3e0XoSvFpWNyWnglauT7M65qCE6kg==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.74.0 + tslib: 2.6.2 + dev: false + + /@sentry/vue@7.74.0(vue@3.3.4): + resolution: {integrity: sha512-Yu8Zo783DlIg6PmpA8DjR4Kmh6E3nH5FiIamkzJ/OYq0LOj0VzIT8iaL+4bQvnJJrgZyWU3sNXLCHB1uVtp4rA==} + engines: {node: '>=8'} + peerDependencies: + vue: 2.x || 3.x + dependencies: + '@sentry/browser': 7.74.0 + '@sentry/core': 7.74.0 + '@sentry/types': 7.74.0 + '@sentry/utils': 7.74.0 + tslib: 2.6.2 + vue: 3.3.4 + dev: false + /@sideway/address@4.1.4: resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} dependencies: @@ -6913,7 +6983,7 @@ packages: ts-dedent: 2.2.0 type-fest: 2.19.0 vue: 3.3.4 - vue-component-type-helpers: 1.8.18 + vue-component-type-helpers: 1.8.19 transitivePeerDependencies: - encoding - supports-color @@ -19171,8 +19241,8 @@ packages: resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==} engines: {node: '>=0.10.0'} - /vue-component-type-helpers@1.8.18: - resolution: {integrity: sha512-SklLIg782E5Ff0qdE68AUrRBhT2YGW97edBewNEjCWCw+RSETcGOjA8m1/6T68CXkymWBSk+KDpPXqIGthqCDg==} + /vue-component-type-helpers@1.8.19: + resolution: {integrity: sha512-1OANGSZK4pzHF4uc86usWi+o5Y0zgoDtqWkPg6Am6ot+jHSAmpOah59V/4N82So5xRgivgCxGgK09lBy1XNUfQ==} dev: true /vue-demi@0.13.11(vue@3.3.4):