From 662a52296c29593bc054910fae481e406ece3a38 Mon Sep 17 00:00:00 2001 From: bouncepaw Date: Sat, 3 Oct 2020 19:19:49 +0500 Subject: [PATCH] Correctly forget about deleted hyphae --- hypha.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hypha.go b/hypha.go index 5c9bb9e..d6920a3 100644 --- a/hypha.go +++ b/hypha.go @@ -41,11 +41,15 @@ type HyphaData struct { // DeleteHypha deletes hypha and makes a history record about that. func (hd *HyphaData) DeleteHypha(hyphaName string) *history.HistoryOp { - return history.Operation(history.TypeDeleteHypha). + hop := history.Operation(history.TypeDeleteHypha). WithFilesRemoved(hd.textPath, hd.binaryPath). WithMsg(fmt.Sprintf("Delete ā€˜%s’", hyphaName)). WithSignature("anon"). Apply() + if len(hop.Errs) == 0 { + delete(HyphaStorage, hyphaName) + } + return hop } // RenameHypha renames hypha from old name `hyphaName` to `newName` and makes a history record about that.