From 8917f47347d68382ea7d29b0e7debd42d4aa9b54 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 18 May 2017 11:15:32 -0300 Subject: [PATCH 1/5] Fix org repos not showing on dashboard search --- routers/api/v1/repo/repo.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 83b1dbd26b9..2c01352fcf8 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -32,6 +32,7 @@ func Search(ctx *context.APIContext) { Keyword: strings.Trim(ctx.Query("q"), " "), OwnerID: ctx.QueryInt64("uid"), PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), + Searcher: ctx.User, } // Check visibility. From c746875fcfc91b61082d1bae58cba7e1fef9eb91 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 18 May 2017 11:16:04 -0300 Subject: [PATCH 2/5] Remove colaborative repo panel --- templates/user/dashboard/dashboard.tmpl | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index cd76a45a56a..cd158663f0b 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -46,29 +46,6 @@ {{end}} - - {{if not .ContextUser.IsOrganization}} -

- {{.i18n.Tr "home.collaborative_repos"}} -

-
- -
- {{end}} {{if not .ContextUser.IsOrganization}} From dc2b28ed769c234def22050e5f2a487b60c697af Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 18 May 2017 11:28:29 -0300 Subject: [PATCH 3/5] Show repos acording to user/organization --- public/js/index.js | 2 +- routers/api/v1/repo/repo.go | 4 +++- templates/base/head.tmpl | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index a3e9e99e7a4..fa1184ed5b2 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1661,7 +1661,7 @@ function initDashboardSearch() { repos: [], searchQuery: '', suburl: document.querySelector('meta[name=_suburl]').content, - uid: document.querySelector('meta[name=_uid]').content + uid: document.querySelector('meta[name=_context_uid]').content }, mounted: function() { diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 2c01352fcf8..c299b969bc1 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -32,7 +32,9 @@ func Search(ctx *context.APIContext) { Keyword: strings.Trim(ctx.Query("q"), " "), OwnerID: ctx.QueryInt64("uid"), PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), - Searcher: ctx.User, + } + if ctx.User.ID == opts.OwnerID { + opts.Searcher = ctx.User } // Check visibility. diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 68a7e43b693..61f0def7d9b 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -14,6 +14,9 @@ {{if .IsSigned}} {{end}} + {{if .ContextUser}} + + {{end}} {{if .GoGetImport}} From 8906b2891ba0dc1aba2acbaee5e0051043894b2f Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 18 May 2017 14:35:06 -0300 Subject: [PATCH 4/5] Fix test There was a panic when there's no logged in user --- routers/api/v1/repo/repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index c299b969bc1..66e430548b5 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -33,7 +33,7 @@ func Search(ctx *context.APIContext) { OwnerID: ctx.QueryInt64("uid"), PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")), } - if ctx.User.ID == opts.OwnerID { + if ctx.User != nil && ctx.User.ID == opts.OwnerID { opts.Searcher = ctx.User } From 12dbdaac76b0eaa625d4e656df725bcd63218420 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sat, 27 May 2017 13:40:54 -0300 Subject: [PATCH 5/5] Fix private repo icon --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index fa1184ed5b2..80d9486fd15 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1698,7 +1698,7 @@ function initDashboardSearch() { } else if (repo.mirror) { return 'octicon octicon-repo-clone'; } else if (repo.private) { - return 'octicon octicon-repo-forked'; + return 'octicon octicon-lock'; } else { return 'octicon octicon-repo'; }