プロキシアカウントをユーザー名ではなくIDで保存するように
This commit is contained in:
parent
ce589fee8c
commit
8818648740
8 changed files with 67 additions and 22 deletions
|
@ -1,9 +1,9 @@
|
|||
import { fetchMeta } from './fetch-meta';
|
||||
import { ILocalUser } from '../models/entities/user';
|
||||
import { Users } from '../models';
|
||||
import { ensure } from '../prelude/ensure';
|
||||
|
||||
export async function fetchProxyAccount(): Promise<ILocalUser> {
|
||||
export async function fetchProxyAccount(): Promise<ILocalUser | null> {
|
||||
if (meta.proxyAccountId == null) return null;
|
||||
const meta = await fetchMeta();
|
||||
return await Users.findOne({ username: meta.proxyAccount!, host: null }).then(ensure) as ILocalUser;
|
||||
return await Users.findOne(meta.proxyAccountId);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue