deletions: put [delete] as page content to block /view/ route

This commit is contained in:
mappu 2018-04-02 17:08:54 +12:00
parent eeb2308c54
commit 6c70f37ef8
4 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,10 @@ import (
"strings"
)
const (
bbcodeIsDeleted string = `[delete]`
)
// An embarassing cascade of half-working hacks follows.
type BBCodeRenderer struct {
baseUrl string

View File

@ -17,6 +17,10 @@ func (this *WikiServer) serveInternalError(w http.ResponseWriter, r *http.Reques
http.Error(w, "An internal error occurred. Please ask an administrator to check the log file.", 500)
}
func (this *WikiServer) serveDeleted(w http.ResponseWriter, lookingFor string) {
this.serveRedirect(w, this.opts.ExternalBaseURL+"history/"+url.PathEscape(lookingFor)+"?error="+url.QueryEscape(`The page you are looking for has been deleted. However, the history is still available.`))
}
func (this *WikiServer) serveErrorText(w http.ResponseWriter, msg string) {
this.serveRedirect(w, this.opts.ExpectBaseURL+"view/"+url.PathEscape(this.opts.DefaultPage)+"?error="+url.QueryEscape(msg))
}

View File

@ -35,6 +35,7 @@ func (this *WikiServer) routeFormatting(w http.ResponseWriter, r *http.Request)
<li>[section=header]content[/section]</li>
<li>[youtube]id[/youtube]</li>
<li>[html]raw html[/html]</li>
<li>` + bbcodeIsDeleted + `</li>
</ul>`
pto.Content = template.HTML(content)

View File

@ -26,6 +26,11 @@ func (this *WikiServer) routeView(w http.ResponseWriter, r *http.Request, articl
return
}
if string(a.Body) == bbcodeIsDeleted {
this.serveDeleted(w, articleTitle)
return
}
pto := DefaultPageTemplateOptions(this.opts)
pto.CurrentPageName = articleTitle
pto.CurrentPageIsArticle = true