blob: 2f57d3d92c14e6fbe61345127e427f19a149fc6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package api
import (
"net/http"
"github.com/ponzu-cms/ponzu/system/item"
)
func hide(res http.ResponseWriter, req *http.Request, it interface{}) bool {
// check if should be hidden
if h, ok := it.(item.Hideable); ok {
err := h.Hide(res, req)
if err == item.ErrAllowHiddenItem {
return false
}
if err != nil {
res.WriteHeader(http.StatusInternalServerError)
return true
}
res.WriteHeader(http.StatusNotFound)
return true
}
return false
}
|