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