aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org/home.go
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-04-30 04:13:58 +0900
committerGitHub <noreply@github.com>2023-04-29 15:13:58 -0400
commitcc64a925602d54f3439dd19f16b5280bd0377a7a (patch)
tree36b9d91bee60fe8e71a6aaaf2a40fac3f554d46e /routers/web/org/home.go
parent94d6b5b09d49b2622c2164a03cfae45dced96c74 (diff)
downloadgitea-cc64a925602d54f3439dd19f16b5280bd0377a7a.tar.gz
gitea-cc64a925602d54f3439dd19f16b5280bd0377a7a.zip
Add follow organization and fix the logic of following page (#24345)
![image](https://user-images.githubusercontent.com/18380374/234740589-066f2e5c-30c7-4fc3-a539-066100e1f138.png) ![image](https://user-images.githubusercontent.com/18380374/234740605-88efe55d-7eaa-422e-ab86-0b5a402ca11c.png) Maybe we can fix user card tmpl in #24319? Or maybe a list is better here ![image](https://user-images.githubusercontent.com/18380374/234451417-7f93df20-4b19-4abb-a62d-4c67e1aa2220.png) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/web/org/home.go')
-rw-r--r--routers/web/org/home.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/web/org/home.go b/routers/web/org/home.go
index 201eefa614..7f38ec51ba 100644
--- a/routers/web/org/home.go
+++ b/routers/web/org/home.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
repo_model "code.gitea.io/gitea/models/repo"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/markup"
@@ -143,6 +144,11 @@ func Home(ctx *context.Context) {
return
}
+ var isFollowing bool
+ if ctx.Doer != nil {
+ isFollowing = user_model.IsFollowing(ctx.Doer.ID, ctx.ContextUser.ID)
+ }
+
ctx.Data["Repos"] = repos
ctx.Data["Total"] = count
ctx.Data["MembersTotal"] = membersCount
@@ -150,6 +156,7 @@ func Home(ctx *context.Context) {
ctx.Data["Teams"] = ctx.Org.Teams
ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull
ctx.Data["PageIsViewRepositories"] = true
+ ctx.Data["IsFollowing"] = isFollowing
pager := context.NewPagination(int(count), setting.UI.User.RepoPagingNum, page, 5)
pager.SetDefaultParams(ctx)