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

release: v2023.10.1-kakurega.1.20.1 #85

Merged
merged 3 commits into from
Oct 16, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
110 changes: 66 additions & 44 deletions packages/backend/src/server/api/endpoints/following/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,57 +118,79 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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);
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -253,6 +254,13 @@ export async function common(createVue: () => App<Element>) {

const app = createVue();

if (!_DEV_) {
Sentry.init({
app,
dsn: 'https://[email protected]/2',
});
}

if (_DEV_) {
app.config.performance = true;
}
Expand Down
76 changes: 73 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading