2021-08-19 04:33:41 -05:00
|
|
|
import define from '../define.js';
|
|
|
|
import { Users } from '@/models/index.js';
|
|
|
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
|
|
|
import { parseAcct } from '@/misc/acct.js';
|
|
|
|
import { User } from '@/models/entities/user.js';
|
2019-05-10 03:30:28 -05:00
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['users'],
|
|
|
|
|
2020-02-15 06:33:32 -06:00
|
|
|
requireCredential: false as const,
|
2019-05-10 03:30:28 -05:00
|
|
|
|
|
|
|
params: {
|
|
|
|
},
|
|
|
|
|
|
|
|
res: {
|
2019-06-27 04:04:09 -05:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-05-10 03:30:28 -05:00
|
|
|
items: {
|
2019-06-27 04:04:09 -05:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-05-10 03:30:28 -05:00
|
|
|
ref: 'User',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default define(meta, async (ps, me) => {
|
|
|
|
const meta = await fetchMeta();
|
|
|
|
|
|
|
|
const users = await Promise.all(meta.pinnedUsers.map(acct => Users.findOne(parseAcct(acct))));
|
|
|
|
|
|
|
|
return await Users.packMany(users.filter(x => x !== undefined) as User[], me, { detail: true });
|
|
|
|
});
|