From 0cfbb6911ddce700769f30f6d639a65135257045 Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Sun, 31 May 2026 20:13:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=B2=E9=94=81=E5=AE=9A=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E7=A6=81=E6=AD=A2=E6=8F=90=E4=BA=A4=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=EF=BC=8C=E9=9A=90=E8=97=8F=E6=8F=90=E4=BA=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SubmitForAudit 新增 IsLocked 检查,锁定文章不可提交审核 - posts/show.html:已锁定文章不显示"提交审核"按钮 --- internal/service/post_service.go | 3 +++ templates/MetaLab-2026/html/posts/show.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/service/post_service.go b/internal/service/post_service.go index 2916107..b24ca98 100644 --- a/internal/service/post_service.go +++ b/internal/service/post_service.go @@ -251,6 +251,9 @@ func (s *PostService) SubmitForAudit(postID uint) error { if err != nil { return err } + if post.IsLocked { + return common.ErrPostCannotEdit + } if post.Status != model.PostStatusDraft && post.Status != model.PostStatusRejected { return common.ErrPostCannotSubmit } diff --git a/templates/MetaLab-2026/html/posts/show.html b/templates/MetaLab-2026/html/posts/show.html index dfc7996..18818aa 100644 --- a/templates/MetaLab-2026/html/posts/show.html +++ b/templates/MetaLab-2026/html/posts/show.html @@ -36,7 +36,7 @@ {{if and $.Post (or (eq $.Post.UserID $.UID) $.CanAccessAdmin) (ne $.Post.Status "pending") (not $.Post.IsLocked)}} 编辑 {{end}} - {{if and $.Post (eq $.Post.UserID $.UID) (or (eq $.Post.Status "draft") (eq $.Post.Status "rejected"))}} + {{if and $.Post (eq $.Post.UserID $.UID) (or (eq $.Post.Status "draft") (eq $.Post.Status "rejected")) (not $.Post.IsLocked)}} {{end}}