From 91c885954a4c53fd24c52a04cc5f0ada19ea04c6 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Wed, 20 Jun 2018 02:35:34 +0900 Subject: [PATCH] Fix sidebar to recent repositories --- .../core/controller/DashboardController.scala | 8 +++---- .../core/controller/IndexController.scala | 17 ++----------- .../core/dashboard/issues.scala.html | 5 ++-- .../gitbucket/core/dashboard/pulls.scala.html | 5 ++-- .../gitbucket/core/dashboard/repos.scala.html | 2 +- .../core/dashboard/sidebar.scala.html | 24 +------------------ .../twirl/gitbucket/core/index.scala.html | 3 +-- .../core/search/repositories.scala.html | 5 ++-- 8 files changed, 14 insertions(+), 55 deletions(-) diff --git a/src/main/scala/gitbucket/core/controller/DashboardController.scala b/src/main/scala/gitbucket/core/controller/DashboardController.scala index cb01a2525..ce0de3aa4 100644 --- a/src/main/scala/gitbucket/core/controller/DashboardController.scala +++ b/src/main/scala/gitbucket/core/controller/DashboardController.scala @@ -26,7 +26,7 @@ trait DashboardControllerBase extends ControllerBase { html.repos( getGroupNames(userName), - Nil, + getVisibleRepositories(None, withoutPhysicalInfo = true), getUserRepositories(userName, withoutPhysicalInfo = true) ) }) @@ -93,8 +93,7 @@ trait DashboardControllerBase extends ControllerBase { }, filter, getGroupNames(userName), - Nil, - getUserRepositories(userName, withoutPhysicalInfo = true) + getVisibleRepositories(None, withoutPhysicalInfo = true) ) } @@ -119,8 +118,7 @@ trait DashboardControllerBase extends ControllerBase { }, filter, getGroupNames(userName), - Nil, - getUserRepositories(userName, withoutPhysicalInfo = true) + getVisibleRepositories(None, withoutPhysicalInfo = true) ) } diff --git a/src/main/scala/gitbucket/core/controller/IndexController.scala b/src/main/scala/gitbucket/core/controller/IndexController.scala index ed9042d8d..d7b3f5ac0 100644 --- a/src/main/scala/gitbucket/core/controller/IndexController.scala +++ b/src/main/scala/gitbucket/core/controller/IndexController.scala @@ -64,8 +64,7 @@ trait IndexControllerBase extends ControllerBase { val visibleOwnerSet: Set[String] = Set(account.userName) ++ getGroupsByUserName(account.userName) gitbucket.core.html.index( getRecentActivitiesByOwners(visibleOwnerSet), - Nil, - getUserRepositories(account.userName, withoutPhysicalInfo = true), + getVisibleRepositories(None, withoutPhysicalInfo = true), showBannerToCreatePersonalAccessToken = hasAccountFederation(account.userName) && !hasAccessToken( account.userName ) @@ -75,7 +74,6 @@ trait IndexControllerBase extends ControllerBase { gitbucket.core.html.index( getRecentActivities(), getVisibleRepositories(None, withoutPhysicalInfo = true), - Nil, showBannerToCreatePersonalAccessToken = false ) } @@ -273,18 +271,7 @@ trait IndexControllerBase extends ControllerBase { val repositories = visibleRepositories.filter { repository => repository.name.toLowerCase.indexOf(query) >= 0 || repository.owner.toLowerCase.indexOf(query) >= 0 } - context.loginAccount - .map { account => - gitbucket.core.search.html.repositories( - query, - repositories, - Nil, - getUserRepositories(account.userName, withoutPhysicalInfo = true) - ) - } - .getOrElse { - gitbucket.core.search.html.repositories(query, repositories, visibleRepositories, Nil) - } + gitbucket.core.search.html.repositories(query, repositories, visibleRepositories) } } diff --git a/src/main/twirl/gitbucket/core/dashboard/issues.scala.html b/src/main/twirl/gitbucket/core/dashboard/issues.scala.html index f23e57652..c2e92ed03 100644 --- a/src/main/twirl/gitbucket/core/dashboard/issues.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/issues.scala.html @@ -5,10 +5,9 @@ condition: gitbucket.core.service.IssuesService.IssueSearchCondition, filter: String, groups: List[String], - recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) + recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) @gitbucket.core.html.main("Issues"){ - @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories){ @gitbucket.core.dashboard.html.tab("issues")
@gitbucket.core.dashboard.html.issuesnavi("issues", filter, openCount, closedCount, condition) diff --git a/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html b/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html index 3d05a84af..b3cf909e7 100644 --- a/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/pulls.scala.html @@ -5,10 +5,9 @@ condition: gitbucket.core.service.IssuesService.IssueSearchCondition, filter: String, groups: List[String], - recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) + recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) @gitbucket.core.html.main("Pull requests"){ - @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories){ @gitbucket.core.dashboard.html.tab("pulls")
@gitbucket.core.dashboard.html.issuesnavi("pulls", filter, openCount, closedCount, condition) diff --git a/src/main/twirl/gitbucket/core/dashboard/repos.scala.html b/src/main/twirl/gitbucket/core/dashboard/repos.scala.html index c5aa4c609..8ca1de064 100644 --- a/src/main/twirl/gitbucket/core/dashboard/repos.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/repos.scala.html @@ -3,7 +3,7 @@ userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers @gitbucket.core.html.main("Repositories"){ - @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories){ @gitbucket.core.dashboard.html.tab("repos")
@if(userRepositories.isEmpty){ diff --git a/src/main/twirl/gitbucket/core/dashboard/sidebar.scala.html b/src/main/twirl/gitbucket/core/dashboard/sidebar.scala.html index 9f59a2ff8..ee7feb032 100644 --- a/src/main/twirl/gitbucket/core/dashboard/sidebar.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/sidebar.scala.html @@ -1,29 +1,8 @@ -@(recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(body: Html)(implicit context: gitbucket.core.controller.Context) +@(recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(body: Html)(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers
diff --git a/src/main/twirl/gitbucket/core/index.scala.html b/src/main/twirl/gitbucket/core/index.scala.html index 83ca41cdc..2552a0153 100644 --- a/src/main/twirl/gitbucket/core/index.scala.html +++ b/src/main/twirl/gitbucket/core/index.scala.html @@ -1,10 +1,9 @@ @(activities: List[gitbucket.core.model.Activity], recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], showBannerToCreatePersonalAccessToken: Boolean)(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers @gitbucket.core.html.main("GitBucket"){ - @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories){ @context.settings.information.map { information =>
diff --git a/src/main/twirl/gitbucket/core/search/repositories.scala.html b/src/main/twirl/gitbucket/core/search/repositories.scala.html index eb450ce27..04ed4dfe9 100644 --- a/src/main/twirl/gitbucket/core/search/repositories.scala.html +++ b/src/main/twirl/gitbucket/core/search/repositories.scala.html @@ -1,10 +1,9 @@ @(query: String, repositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo], - userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) + recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers @gitbucket.core.html.main("GitBucket"){ - @gitbucket.core.dashboard.html.sidebar(recentRepositories, userRepositories){ + @gitbucket.core.dashboard.html.sidebar(recentRepositories){