Skip to content

Commit a6b66fc

Browse files
fix2015eoao
authored andcommitted
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
1 parent 43ed023 commit a6b66fc

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

mail-worker/src/service/email-service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,9 @@ const emailService = {
857857
query.orderBy(desc(email.emailId));
858858
}
859859

860-
const listQuery = await query.limit(size).all();
861-
const totalQuery = await queryCount.get();
862-
const latestEmailQuery = await orm(c).select().from(email)
860+
const listQuery = query.limit(size).all();
861+
const totalQuery = queryCount.get();
862+
const latestEmailQuery = orm(c).select().from(email)
863863
.where(and(
864864
eq(email.type, emailConst.type.RECEIVE),
865865
ne(email.status, emailConst.status.SAVING)

mail-worker/src/service/oauth-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const oauthService = {
7070

7171
userInfo.oauthUserId = String(userInfo.id);
7272
userInfo.active = userInfo.active ? 0 : 1;
73-
userInfo.silenced = userInfo.active ? 0 : 1;
73+
userInfo.silenced = userInfo.silenced ? 0 : 1;
7474
userInfo.trustLevel = userInfo.trust_level;
7575
userInfo.avatar = userInfo.avatar_url;
7676

mail-worker/src/service/role-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const roleService = {
177177

178178
selectByUserIds(c, userIds) {
179179

180-
if (!userIds && userIds.length === 0) {
180+
if (!userIds || userIds.length === 0) {
181181
return [];
182182
}
183183

0 commit comments

Comments
 (0)