补齐收件回复入口并限制原邮件归属与类型
This commit is contained in:
1 parent
ec1481c99f
commit
0ef04823ab
6 files changed
+13
-3
No files matched your search
@@ -18,7 +18,7 @@ func applyReplyThread(ctx *context.Context, input sendRequest, message *parsemai
|
|||||||
if id == 0 {
|
if id == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if id < 0 || ctx == nil || ctx.UserID <= 0 || db.Instance == nil || message == nil {
|
if id < 0 || ctx == nil || ctx.UserID <= 0 || db.Instance == nil {
|
||||||
return validation.ErrInvalidEmail
|
return validation.ErrInvalidEmail
|
||||||
}
|
}
|
||||||
if input.DraftID > 0 {
|
if input.DraftID > 0 {
|
||||||
@@ -37,6 +37,7 @@ func applyReplyThread(ctx *context.Context, input sendRequest, message *parsemai
|
|||||||
var original models.Email
|
var original models.Email
|
||||||
found, err := db.Instance.ID(id).
|
found, err := db.Instance.ID(id).
|
||||||
Where("status <> ?", consts.EmailStatusDrafts).
|
Where("status <> ?", consts.EmailStatusDrafts).
|
||||||
|
And("type = ?", consts.EmailTypeReceive).
|
||||||
And("EXISTS (SELECT 1 FROM user_email WHERE email_id = ? AND user_id = ? AND is_deleted = 0)", id, ctx.UserID).
|
And("EXISTS (SELECT 1 FROM user_email WHERE email_id = ? AND user_id = ? AND is_deleted = 0)", id, ctx.UserID).
|
||||||
Get(&original)
|
Get(&original)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ func buildEnvelope(email *response.EmailResponseData, traEmail *parsemail.Email)
|
|||||||
Bcc: usersToAddresses(traEmail.Bcc),
|
Bcc: usersToAddresses(traEmail.Bcc),
|
||||||
MessageID: messageID,
|
MessageID: messageID,
|
||||||
InReplyTo: parsemail.ThreadMessageIDs(email.InReplyTo),
|
InReplyTo: parsemail.ThreadMessageIDs(email.InReplyTo),
|
||||||
// InReplyTo 和 References 暂不支持
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// 管理后台统一使用中文。
|
// 管理后台统一使用中文。
|
||||||
const lang = {
|
const lang = {
|
||||||
|
"mail_reply": "回复",
|
||||||
"mail_no_subject": "(无主题)",
|
"mail_no_subject": "(无主题)",
|
||||||
"draft_save": "保存草稿",
|
"draft_save": "保存草稿",
|
||||||
"draft_saved": "草稿已保存",
|
"draft_saved": "草稿已保存",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const plainBody = message => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function prepareReply(message, identity) {
|
export function prepareReply(message, identity) {
|
||||||
|
if (message.type !== 0) throw new Error(lang.fail)
|
||||||
const replyTo = readAddresses(message.reply_to)
|
const replyTo = readAddresses(message.reply_to)
|
||||||
const recipients = replyTo.length ? replyTo : [{EmailAddress: message.from_address, Name: message.from_name}]
|
const recipients = replyTo.length ? replyTo : [{EmailAddress: message.from_address, Name: message.from_name}]
|
||||||
if (!recipients.length || recipients.some(item => !item.EmailAddress || /[\r\n]/.test(item.EmailAddress))) {
|
if (!recipients.length || recipients.some(item => !item.EmailAddress || /[\r\n]/.test(item.EmailAddress))) {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export function usePage() {
|
|||||||
const backToList = () => router.push({name: 'list'})
|
const backToList = () => router.push({name: 'list'})
|
||||||
const handleReply = () => {
|
const handleReply = () => {
|
||||||
const id = Number(detailData.value.id)
|
const id = Number(detailData.value.id)
|
||||||
if (loading.value || loadError.value || !Number.isSafeInteger(id) || id <= 0) return
|
if (loading.value || loadError.value || detailData.value.type !== 0 || !Number.isSafeInteger(id) || id <= 0) return
|
||||||
return router.push({name: 'editer', query: {reply: String(id)}})
|
return router.push({name: 'editer', query: {reply: String(id)}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
<el-icon><Back /></el-icon>
|
<el-icon><Back /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<div v-if="!loading && !loadError" class="action-buttons">
|
<div v-if="!loading && !loadError" class="action-buttons">
|
||||||
|
<el-button
|
||||||
|
v-if="detailData.type === 0"
|
||||||
|
type="primary"
|
||||||
|
@click="handleReply"
|
||||||
|
>
|
||||||
|
{{ lang.mail_reply }}
|
||||||
|
</el-button>
|
||||||
<el-button plain @click="handleDelete" aria-label="删除邮件">
|
<el-button plain @click="handleDelete" aria-label="删除邮件">
|
||||||
<el-icon><Delete /></el-icon>
|
<el-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -90,6 +97,7 @@
|
|||||||
import { usePage, Back, Delete, Document, Download } from './EmailDetail.js'
|
import { usePage, Back, Delete, Document, Download } from './EmailDetail.js'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
handleReply,
|
||||||
handleDelete,
|
handleDelete,
|
||||||
loading,
|
loading,
|
||||||
loadError,
|
loadError,
|
||||||
|
|||||||
Reference in new issue
Block a user