2021-08-19 07:55:45 -05:00
|
|
|
import define from '../define';
|
|
|
|
import { Users } from '@/models/index';
|
|
|
|
import { fetchMeta } from '@/misc/fetch-meta';
|
2021-11-11 11:02:25 -06:00
|
|
|
import * as Acct from 'misskey-js/built/acct';
|
2021-08-19 07:55:45 -05:00
|
|
|
import { User } from '@/models/entities/user';
|
2019-05-10 03:30:28 -05:00
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['users'],
|
|
|
|
|
2022-01-18 07:27:10 -06:00
|
|
|
requireCredential: false,
|
2019-05-10 03:30:28 -05:00
|
|
|
|
|
|
|
res: {
|
2022-01-18 07:27:10 -06:00
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
2019-05-10 03:30:28 -05:00
|
|
|
items: {
|
2022-01-18 07:27:10 -06:00
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
ref: 'UserDetailed',
|
2021-12-09 08:58:30 -06:00
|
|
|
},
|
2019-05-10 03:30:28 -05:00
|
|
|
},
|
2022-01-18 07:27:10 -06:00
|
|
|
} as const;
|
2019-05-10 03:30:28 -05:00
|
|
|
|
2022-02-19 22:15:40 -06:00
|
|
|
export const paramDef = {
|
2022-02-18 23:05:32 -06:00
|
|
|
type: 'object',
|
|
|
|
properties: {},
|
|
|
|
required: [],
|
|
|
|
} as const;
|
|
|
|
|
2022-01-02 11:12:50 -06:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-02-18 23:05:32 -06:00
|
|
|
export default define(meta, paramDef, async (ps, me) => {
|
2019-05-10 03:30:28 -05:00
|
|
|
const meta = await fetchMeta();
|
|
|
|
|
2021-11-11 11:02:25 -06:00
|
|
|
const users = await Promise.all(meta.pinnedUsers.map(acct => Users.findOne(Acct.parse(acct))));
|
2019-05-10 03:30:28 -05:00
|
|
|
|
|
|
|
return await Users.packMany(users.filter(x => x !== undefined) as User[], me, { detail: true });
|
|
|
|
});
|