1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-08 07:24:09 +02:00

feat: 投稿通知設定したユーザーをリストで見ることができるように (#17385)

* feat: 投稿通知を設定したユーザーをリストで見ることができるように

* test(e2e): 投稿通知のテスト追加

* chore: 不必要なコードの削除
This commit is contained in:
4ster1sk
2026-05-12 21:34:45 +09:00
committed by GitHub
parent bf3c1f6686
commit 6665c398d6
11 changed files with 377 additions and 1 deletions

View File

@@ -391,6 +391,7 @@ export * as 'users/featured-notes' from './endpoints/users/featured-notes.js';
export * as 'users/flashs' from './endpoints/users/flashs.js';
export * as 'users/followers' from './endpoints/users/followers.js';
export * as 'users/following' from './endpoints/users/following.js';
export * as 'users/notify/list' from './endpoints/users/notify/list.js';
export * as 'users/get-following-users-by-birthday' from './endpoints/users/get-following-users-by-birthday.js';
export * as 'users/gallery/posts' from './endpoints/users/gallery/posts.js';
export * as 'users/get-frequently-replied-users' from './endpoints/users/get-frequently-replied-users.js';

View File

@@ -0,0 +1,66 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Inject, Injectable } from '@nestjs/common';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import type { FollowingsRepository } from '@/models/_.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { QueryService } from '@/core/QueryService.js';
import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['users'],
requireCredential: true,
kind: 'read:following',
description: 'List of following users with notification enabled.',
res: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
},
},
} as const;
export const paramDef = {
type: 'object',
properties: {
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
sinceDate: { type: 'integer' },
untilDate: { type: 'integer' },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
},
} 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,
private userEntityService: UserEntityService,
private queryService: QueryService,
) {
super(meta, paramDef, async (ps, me) => {
const query = this.queryService.makePaginationQuery(this.followingsRepository.createQueryBuilder('following'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.innerJoinAndSelect('following.followee', 'followee')
.andWhere('following.followerId = :userId', { userId: me.id })
.andWhere('following.notify IS NOT NULL');
const followings = await query
.limit(ps.limit)
.getMany();
const users = followings.map(f => f.followee!);
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}