1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 03:36:16 +00:00

Show revisions of deleted hyphae

This commit is contained in:
Timur Ismagilov 2021-07-30 19:16:58 +05:00
parent a1e04888ee
commit b7cbe04cfc
2 changed files with 11 additions and 1 deletions

View File

@ -2,7 +2,9 @@
package hyphae
import (
"github.com/bouncepaw/mycorrhiza/files"
"log"
"path/filepath"
"regexp"
"sync"
)
@ -19,6 +21,14 @@ type Hypha struct {
BinaryPath string // == "" => no attachment
}
// TextPartPath returns rooted path to the file where the text part should be.
func (h *Hypha) TextPartPath() string {
if h.TextPath == "" {
return filepath.Join(files.HyphaeDir(), h.Name+".myco")
}
return h.TextPath
}
var byNames = make(map[string]*Hypha)
var byNamesMutex = sync.Mutex{}

View File

@ -73,7 +73,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
hyphaName = util.CanonicalName(shorterUrl[firstSlashIndex+1:])
h = hyphae.ByName(hyphaName)
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
textContents, err = history.FileAtRevision(h.TextPath, revHash)
textContents, err = history.FileAtRevision(h.TextPartPath(), revHash)
u = user.FromRequest(rq)
)
if err == nil {