forked from FoundKeyGang/FoundKey
fix new occurences of isDeleted
This commit is contained in:
parent
e584937b4f
commit
4307010a9f
4 changed files with 11 additions and 11 deletions
|
@ -32,7 +32,7 @@ export async function getNote(noteId: Note['id'], me: { id: User['id'] } | null)
|
|||
export async function getUser(userId: User['id'], includeSuspended = false) {
|
||||
const user = await Users.findOneBy({
|
||||
id: userId,
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
...(includeSuspended ? {} : {isSuspended: false}),
|
||||
});
|
||||
|
||||
|
@ -50,7 +50,7 @@ export async function getRemoteUser(userId: User['id'], includeSuspended = false
|
|||
const user = await Users.findOneBy({
|
||||
id: userId,
|
||||
host: Not(IsNull()),
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
...(includeSuspended ? {} : {isSuspended: false}),
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ export async function getLocalUser(userId: User['id'], includeSuspended = false)
|
|||
const user = await Users.findOneBy({
|
||||
id: userId,
|
||||
host: IsNull(),
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
...(includeSuspended ? {} : {isSuspended: false}),
|
||||
});
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ export default async (ctx: Koa.Context) => {
|
|||
const user = await Users.findOneBy({
|
||||
usernameLower: username.toLowerCase(),
|
||||
host: IsNull(),
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
}) as ILocalUser;
|
||||
|
||||
if (user == null) {
|
||||
|
|
|
@ -223,7 +223,7 @@ const getFeed = async (acct: string) => {
|
|||
usernameLower: username.toLowerCase(),
|
||||
host: host ?? IsNull(),
|
||||
isSuspended: false,
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
});
|
||||
|
||||
return user && await packFeed(user);
|
||||
|
@ -273,7 +273,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => {
|
|||
usernameLower: username.toLowerCase(),
|
||||
host: host ?? IsNull(),
|
||||
isSuspended: false,
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
});
|
||||
|
||||
if (user != null) {
|
||||
|
@ -306,7 +306,7 @@ router.get('/users/:user', async ctx => {
|
|||
id: ctx.params.user,
|
||||
host: IsNull(),
|
||||
isSuspended: false,
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
});
|
||||
|
||||
if (user == null) {
|
||||
|
@ -423,7 +423,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => {
|
|||
usernameLower: username.toLowerCase(),
|
||||
host: host ?? IsNull(),
|
||||
isSuspended: false,
|
||||
isDeleted: false,
|
||||
isDeleted: IsNull(),
|
||||
});
|
||||
|
||||
if (user == null) return;
|
||||
|
|
|
@ -6,15 +6,15 @@ import { subscriber } from '@/db/redis.js';
|
|||
|
||||
export const userByIdCache = new Cache<User>(
|
||||
Infinity,
|
||||
async (id) => await Users.findOneBy({ id, isDeleted: false }) ?? undefined,
|
||||
async (id) => await Users.findOneBy({ id, isDeleted: IsNull() }) ?? undefined,
|
||||
);
|
||||
export const localUserByNativeTokenCache = new Cache<ILocalUser>(
|
||||
Infinity,
|
||||
async (token) => await Users.findOneBy({ token, host: IsNull(), isDeleted: false }) as ILocalUser | null ?? undefined,
|
||||
async (token) => await Users.findOneBy({ token, host: IsNull(), isDeleted: isNull() }) as ILocalUser | null ?? undefined,
|
||||
);
|
||||
export const uriPersonCache = new Cache<User>(
|
||||
Infinity,
|
||||
async (uri) => await Users.findOneBy({ uri, isDeleted: false }) ?? undefined,
|
||||
async (uri) => await Users.findOneBy({ uri, isDeleted: IsNull() }) ?? undefined,
|
||||
);
|
||||
|
||||
subscriber.on('message', async (_, data) => {
|
||||
|
|
Loading…
Reference in a new issue