1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-09-11 11:46:24 -07:00

Show correct role on staff dashboard

This commit is contained in:
Eggbertx 2022-07-25 14:13:33 -07:00
parent 24cf95f400
commit 28a53add0a
2 changed files with 12 additions and 1 deletions

View file

@ -134,11 +134,22 @@ func dashboardCallback(writer http.ResponseWriter, request *http.Request, wantsJ
return nil, err
}
rank := GetStaffRank(request)
rankString := ""
switch rank {
case AdminPerms:
rankString = "administrator"
case ModPerms:
rankString = "moderator"
case JanitorPerms:
rankString = "janitor"
}
availableActions := getAvailableActions(rank, true)
if err = serverutil.MinifyTemplate(gctemplates.ManageDashboard,
map[string]interface{}{
"actions": availableActions,
"rank": rank,
"rankString": rankString,
"announcements": announcements,
"boards": gcsql.AllBoards,
"webroot": config.GetSystemCriticalConfig().WebRoot,

View file

@ -20,7 +20,7 @@
<i>No boards</i>
{{end}}
</fieldset><br />
<fieldset><legend>Staff actions (role: administrator)</legend>
<fieldset><legend>Staff actions (role: {{$.rankString}})</legend>
<ul>
{{range $a, $action := $.actions}}
{{if ne $action.Title "Dashboard"}}<li><a href="{{$.webroot}}manage?action={{$action.ID}}">{{$action.Title}}</a> </li>{{end}}