diff options
| author | anatawa12 <anatawa12@icloud.com> | 2023-10-21 18:39:19 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-21 18:39:19 +0900 |
| commit | 722584bf72a1432dbaad8b868c9b44bb5cd7cd30 (patch) | |
| tree | 5b0a396bc1b6fe6befe762606c90c9f7e6f8770d /packages/backend/src/server/api/endpoints/following/update-all.ts | |
| parent | プロフィールのURL認証をrel=meで可能に (#12100) (diff) | |
| download | sharkey-722584bf72a1432dbaad8b868c9b44bb5cd7cd30.tar.gz sharkey-722584bf72a1432dbaad8b868c9b44bb5cd7cd30.tar.bz2 sharkey-722584bf72a1432dbaad8b868c9b44bb5cd7cd30.zip | |
すべてのフォロー中の人のwithRepliesを変える機能 (#12049)
* feat: endpoint to update all following
* feat(frontend): change show replies for all
* docs(changelog): すでにフォローしたすべての人の返信をTLに追加できるように
* fix: cancel not working
Diffstat (limited to 'packages/backend/src/server/api/endpoints/following/update-all.ts')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/following/update-all.ts | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/endpoints/following/update-all.ts b/packages/backend/src/server/api/endpoints/following/update-all.ts new file mode 100644 index 0000000000..28734cfdbd --- /dev/null +++ b/packages/backend/src/server/api/endpoints/following/update-all.ts @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import ms from 'ms'; +import { Inject, Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import type { FollowingsRepository } from '@/models/_.js'; +import { UserEntityService } from '@/core/entities/UserEntityService.js'; +import { UserFollowingService } from '@/core/UserFollowingService.js'; +import { DI } from '@/di-symbols.js'; +import { GetterService } from '@/server/api/GetterService.js'; +import { ApiError } from '../../error.js'; + +export const meta = { + tags: ['following', 'users'], + + limit: { + duration: ms('1hour'), + max: 10, + }, + + requireCredential: true, + + kind: 'write:following', +} as const; + +export const paramDef = { + type: 'object', + properties: { + notify: { type: 'string', enum: ['normal', 'none'] }, + withReplies: { type: 'boolean' }, + }, +} as const; + +@Injectable() +export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export + constructor( + @Inject(DI.followingsRepository) + private followingsRepository: FollowingsRepository, + ) { + super(meta, paramDef, async (ps, me) => { + await this.followingsRepository.update({ + followerId: me.id, + }, { + notify: ps.notify != null ? (ps.notify === 'none' ? null : ps.notify) : undefined, + withReplies: ps.withReplies != null ? ps.withReplies : undefined, + }); + + return; + }); + } +} |