Skip to content

Commit 1207f9a

Browse files
inject group-related values in OrgAssignment
1 parent 45ac44d commit 1207f9a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

services/context/org.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package context
66

77
import (
8+
shared_group "code.gitea.io/gitea/models/shared/group"
89
"strings"
910

1011
"code.gitea.io/gitea/models/organization"
@@ -250,5 +251,19 @@ func OrgAssignment(opts OrgAssignmentOptions) func(ctx *Context) {
250251
}
251252
ctx.Data["RenderedDescription"] = content
252253
}
254+
ctx.Data["AsGroupItem"] = func(v any) shared_group.GroupItem {
255+
if gi, ok := v.(shared_group.GroupItem); ok {
256+
return gi
257+
}
258+
return nil
259+
}
260+
ctx.Data["GroupNavItems"] = shared_group.GetTopLevelGroupItemList(ctx, ctx.ContextUser.ID, ctx.Doer)
261+
ctx.Data["GroupIsCurrent"] = groupIsCurrent(ctx)
262+
ctx.Data["GroupHasChild"] = func(it shared_group.GroupItem) bool {
263+
if ctx.RepoGroup == nil || ctx.RepoGroup.Group == nil {
264+
return false
265+
}
266+
return shared_group.GroupItemHasChild(it, ctx.RepoGroup.Group.ID, ctx, ctx.Doer)
267+
}
253268
}
254269
}

0 commit comments

Comments
 (0)