mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-08-04 06:16:11 +00:00
Merge branch 'develop' into room
This commit is contained in:
@@ -217,6 +217,7 @@ export * as 'flash/search' from './endpoints/flash/search.js';
|
||||
export * as 'following/create' from './endpoints/following/create.js';
|
||||
export * as 'following/delete' from './endpoints/following/delete.js';
|
||||
export * as 'following/invalidate' from './endpoints/following/invalidate.js';
|
||||
export * as 'following/list' from './endpoints/following/list.js';
|
||||
export * as 'following/requests/accept' from './endpoints/following/requests/accept.js';
|
||||
export * as 'following/requests/cancel' from './endpoints/following/requests/cancel.js';
|
||||
export * as 'following/requests/list' from './endpoints/following/requests/list.js';
|
||||
@@ -391,7 +392,6 @@ 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';
|
||||
|
||||
+13
-10
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { FollowingEntityService } from '@/core/entities/FollowingEntityService.js';
|
||||
import type { FollowingsRepository } from '@/models/_.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { QueryService } from '@/core/QueryService.js';
|
||||
@@ -15,7 +15,7 @@ export const meta = {
|
||||
|
||||
requireCredential: true,
|
||||
kind: 'read:following',
|
||||
description: 'List of following users with notification enabled.',
|
||||
description: 'List of following users',
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
@@ -23,7 +23,7 @@ export const meta = {
|
||||
items: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'UserDetailed',
|
||||
ref: 'Following',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
@@ -31,6 +31,7 @@ export const meta = {
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
notification: { type: 'boolean', default: false },
|
||||
sinceId: { type: 'string', format: 'misskey:id' },
|
||||
untilId: { type: 'string', format: 'misskey:id' },
|
||||
sinceDate: { type: 'integer' },
|
||||
@@ -45,22 +46,24 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
@Inject(DI.followingsRepository)
|
||||
private followingsRepository: FollowingsRepository,
|
||||
|
||||
private userEntityService: UserEntityService,
|
||||
private followingEntityService: FollowingEntityService,
|
||||
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');
|
||||
.andWhere('following.followerId = :userId', { userId: me.id });
|
||||
|
||||
if (ps.notification) {
|
||||
query.andWhere('following.notify IS NOT NULL');
|
||||
}
|
||||
|
||||
query.innerJoinAndSelect('following.followee', 'followee');
|
||||
|
||||
const followings = await query
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
const users = followings.map(f => f.followee!);
|
||||
|
||||
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
|
||||
return await this.followingEntityService.packMany(followings, me, { populateFollowee: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user