From 2760a0e29ffdb072fdb52fafd2f33b512e4ddba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Fri, 27 Dec 2024 21:56:51 -0500 Subject: [PATCH] add `GroupLink` method to `Group` struct --- models/group/group.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/group/group.go b/models/group/group.go index 12629dc0b0..c4df33231d 100644 --- a/models/group/group.go +++ b/models/group/group.go @@ -10,6 +10,8 @@ import ( "context" "errors" "fmt" + "net/url" + "strconv" "xorm.io/builder" ) @@ -32,6 +34,11 @@ type Group struct { Subgroups GroupList `xorm:"-"` } +// GroupLink returns the link to this group +func (g *Group) GroupLink() string { + return setting.AppSubURL + "/" + url.PathEscape(g.OwnerName) + "/groups/" + strconv.FormatInt(g.ID, 10) +} + func (Group) TableName() string { return "repo_group" } func init() {