mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-22 16:16:51 +00:00
Show revisions of deleted hyphae
This commit is contained in:
parent
a1e04888ee
commit
b7cbe04cfc
@ -2,7 +2,9 @@
|
|||||||
package hyphae
|
package hyphae
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/bouncepaw/mycorrhiza/files"
|
||||||
"log"
|
"log"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -19,6 +21,14 @@ type Hypha struct {
|
|||||||
BinaryPath string // == "" => no attachment
|
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 byNames = make(map[string]*Hypha)
|
||||||
var byNamesMutex = sync.Mutex{}
|
var byNamesMutex = sync.Mutex{}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
|||||||
hyphaName = util.CanonicalName(shorterUrl[firstSlashIndex+1:])
|
hyphaName = util.CanonicalName(shorterUrl[firstSlashIndex+1:])
|
||||||
h = hyphae.ByName(hyphaName)
|
h = hyphae.ByName(hyphaName)
|
||||||
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
|
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)
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user