修复星标不能查看,附件等多个bug,优化样式
This commit is contained in:
@@ -5,7 +5,7 @@ import settingService from '../service/setting-service';
|
||||
import attService from '../service/att-service';
|
||||
import constant from '../const/constant';
|
||||
import fileUtils from '../utils/file-utils';
|
||||
import { emailConst, isDel } from '../const/entity-const';
|
||||
import {attConst, emailConst, isDel} from '../const/entity-const';
|
||||
|
||||
export async function email(message, env, ctx) {
|
||||
|
||||
@@ -60,6 +60,7 @@ export async function email(message, env, ctx) {
|
||||
attachment.emailId = emailRow.emailId;
|
||||
attachment.userId = emailRow.userId;
|
||||
attachment.accountId = emailRow.accountId;
|
||||
attachment.type = attachment.contentId ? attConst.type.EMBED : attConst.type.ATT
|
||||
})
|
||||
|
||||
if (attachments.length > 0) {
|
||||
|
||||
@@ -46,11 +46,9 @@ const accountService = {
|
||||
const userRow = await userService.selectById(c, userId);
|
||||
const roleRow = await roleService.selectById(c, userRow.type);
|
||||
|
||||
if (roleRow.accountCount) {
|
||||
|
||||
if (roleRow.accountCount && userRow.email !== c.env.admin) {
|
||||
const userAccountCount = await accountService.countUserAccount(c, userId)
|
||||
if(userAccountCount >= roleRow.accountCount) throw new BizError(`添加邮箱数量限制${roleRow.accountCount}个`, 403);
|
||||
|
||||
}
|
||||
|
||||
if (await settingService.isAddEmailVerify(c)) {
|
||||
|
||||
@@ -154,7 +154,12 @@ const attService = {
|
||||
},
|
||||
|
||||
selectByEmailIds(c, emailIds) {
|
||||
return orm(c).select().from(att).where(and(inArray(att.emailId,emailIds),eq(att.type, attConst.type.ATT))).all();
|
||||
return orm(c).select().from(att).where(
|
||||
and(
|
||||
inArray(att.emailId,emailIds),
|
||||
eq(att.type, attConst.type.ATT),
|
||||
isNull(att.contentId)))
|
||||
.all();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ import BizError from '../error/biz-error';
|
||||
import { and, desc, eq, lt, sql, inArray } from 'drizzle-orm';
|
||||
import email from '../entity/email';
|
||||
import { isDel } from '../const/entity-const';
|
||||
import { att } from '../entity/att';
|
||||
import userService from './user-service';
|
||||
import attService from "./att-service";
|
||||
|
||||
const starService = {
|
||||
|
||||
@@ -64,6 +63,16 @@ const starService = {
|
||||
.orderBy(desc(star.emailId))
|
||||
.limit(size)
|
||||
.all();
|
||||
|
||||
const emailIds = list.map(item => item.emailId);
|
||||
|
||||
const attsList = await attService.selectByEmailIds(c, emailIds);
|
||||
|
||||
list.forEach(emailRow => {
|
||||
const atts = attsList.filter(attsRow => attsRow.emailId === emailRow.emailId);
|
||||
emailRow.attList = atts;
|
||||
});
|
||||
|
||||
return { list };
|
||||
},
|
||||
async removeByEmailIds(c, emailIds) {
|
||||
|
||||
Reference in New Issue
Block a user