From 27c80da76d4558e5ee3e19538b928b87baf34ffc Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 5 Jun 2022 15:16:46 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=B6=88=E6=81=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=98=BE=E7=A4=BA=E5=A4=9A=E6=9D=A1=20https:?= =?UTF-8?q?//github.com/siyuan-note/siyuan/issues/4875?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/history.go | 3 ++- kernel/model/assets.go | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/api/history.go b/kernel/api/history.go index b9c08320d..0255a09ea 100644 --- a/kernel/api/history.go +++ b/kernel/api/history.go @@ -62,7 +62,7 @@ func clearWorkspaceHistory(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) - util.PushMsg(model.Conf.Language(100), 1000*60*15) + msgId := util.PushMsg(model.Conf.Language(100), 1000*60*15) time.Sleep(3 * time.Second) err := model.ClearWorkspaceHistory() if nil != err { @@ -70,6 +70,7 @@ func clearWorkspaceHistory(c *gin.Context) { ret.Msg = err.Error() return } + util.PushClearMsg(msgId) util.PushMsg(model.Conf.Language(99), 1000*5) } diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 3f07737c8..28da39525 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -370,8 +370,11 @@ func saveWorkspaceAssets(assets []string) { } func RemoveUnusedAssets() (ret []string) { - util.PushMsg(Conf.Language(100), 30*1000) - defer util.PushMsg(Conf.Language(99), 3000) + msgId := util.PushMsg(Conf.Language(100), 30*1000) + defer func() { + util.PushClearMsg(msgId) + util.PushMsg(Conf.Language(99), 3000) + }() ret = []string{} unusedAssets := UnusedAssets()