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) {
|
export async function getUser(userId: User['id'], includeSuspended = false) {
|
||||||
const user = await Users.findOneBy({
|
const user = await Users.findOneBy({
|
||||||
id: userId,
|
id: userId,
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
...(includeSuspended ? {} : {isSuspended: false}),
|
...(includeSuspended ? {} : {isSuspended: false}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export async function getRemoteUser(userId: User['id'], includeSuspended = false
|
||||||
const user = await Users.findOneBy({
|
const user = await Users.findOneBy({
|
||||||
id: userId,
|
id: userId,
|
||||||
host: Not(IsNull()),
|
host: Not(IsNull()),
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
...(includeSuspended ? {} : {isSuspended: false}),
|
...(includeSuspended ? {} : {isSuspended: false}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ export async function getLocalUser(userId: User['id'], includeSuspended = false)
|
||||||
const user = await Users.findOneBy({
|
const user = await Users.findOneBy({
|
||||||
id: userId,
|
id: userId,
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
...(includeSuspended ? {} : {isSuspended: false}),
|
...(includeSuspended ? {} : {isSuspended: false}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default async (ctx: Koa.Context) => {
|
||||||
const user = await Users.findOneBy({
|
const user = await Users.findOneBy({
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
}) as ILocalUser;
|
}) as ILocalUser;
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|
|
@ -223,7 +223,7 @@ const getFeed = async (acct: string) => {
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
host: host ?? IsNull(),
|
host: host ?? IsNull(),
|
||||||
isSuspended: false,
|
isSuspended: false,
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
return user && await packFeed(user);
|
return user && await packFeed(user);
|
||||||
|
@ -273,7 +273,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => {
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
host: host ?? IsNull(),
|
host: host ?? IsNull(),
|
||||||
isSuspended: false,
|
isSuspended: false,
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
|
@ -306,7 +306,7 @@ router.get('/users/:user', async ctx => {
|
||||||
id: ctx.params.user,
|
id: ctx.params.user,
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
isSuspended: false,
|
isSuspended: false,
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
@ -423,7 +423,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => {
|
||||||
usernameLower: username.toLowerCase(),
|
usernameLower: username.toLowerCase(),
|
||||||
host: host ?? IsNull(),
|
host: host ?? IsNull(),
|
||||||
isSuspended: false,
|
isSuspended: false,
|
||||||
isDeleted: false,
|
isDeleted: IsNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
|
|
|
@ -6,15 +6,15 @@ import { subscriber } from '@/db/redis.js';
|
||||||
|
|
||||||
export const userByIdCache = new Cache<User>(
|
export const userByIdCache = new Cache<User>(
|
||||||
Infinity,
|
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>(
|
export const localUserByNativeTokenCache = new Cache<ILocalUser>(
|
||||||
Infinity,
|
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>(
|
export const uriPersonCache = new Cache<User>(
|
||||||
Infinity,
|
Infinity,
|
||||||
async (uri) => await Users.findOneBy({ uri, isDeleted: false }) ?? undefined,
|
async (uri) => await Users.findOneBy({ uri, isDeleted: IsNull() }) ?? undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
subscriber.on('message', async (_, data) => {
|
subscriber.on('message', async (_, data) => {
|
||||||
|
|
Loading…
Reference in a new issue