fix: null check logic, silenced flag inversion, sequential query perf
- role-service had if (!userIds && userIds.length === 0) which crashes with TypeError when userIds is null — changed && to || - oauth-service was setting silenced based on the already-inverted active value instead of the original silenced field from the API - email-service was awaiting three queries individually then passing the resolved values to Promise.all, making them run sequentially instead of in parallel
This commit is contained in:
committed by
aslost
parent
9552f532f1
commit
5c8c8a6dc7
@@ -857,9 +857,9 @@ const emailService = {
|
||||
query.orderBy(desc(email.emailId));
|
||||
}
|
||||
|
||||
const listQuery = await query.limit(size).all();
|
||||
const totalQuery = await queryCount.get();
|
||||
const latestEmailQuery = await orm(c).select().from(email)
|
||||
const listQuery = query.limit(size).all();
|
||||
const totalQuery = queryCount.get();
|
||||
const latestEmailQuery = orm(c).select().from(email)
|
||||
.where(and(
|
||||
eq(email.type, emailConst.type.RECEIVE),
|
||||
ne(email.status, emailConst.status.SAVING)
|
||||
|
||||
@@ -70,7 +70,7 @@ const oauthService = {
|
||||
|
||||
userInfo.oauthUserId = String(userInfo.id);
|
||||
userInfo.active = userInfo.active ? 0 : 1;
|
||||
userInfo.silenced = userInfo.active ? 0 : 1;
|
||||
userInfo.silenced = userInfo.silenced ? 0 : 1;
|
||||
userInfo.trustLevel = userInfo.trust_level;
|
||||
userInfo.avatar = userInfo.avatar_url;
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ const roleService = {
|
||||
|
||||
selectByUserIds(c, userIds) {
|
||||
|
||||
if (!userIds && userIds.length === 0) {
|
||||
if (!userIds || userIds.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user