diff options
-rw-r--r-- | public/js/index.js | 2 | ||||
-rw-r--r-- | routers/api/v1/repo/repo.go | 4 | ||||
-rw-r--r-- | 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 a3e9e99e7a..fa1184ed5b 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 2c01352fcf..c299b969bc 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 68a7e43b69..61f0def7d9 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -14,6 +14,9 @@ {{if .IsSigned}} <meta name="_uid" content="{{.SignedUser.ID}}" /> {{end}} + {{if .ContextUser}} + <meta name="_context_uid" content="{{.ContextUser.ID}}" /> + {{end}} {{if .GoGetImport}} <meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}"> <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}"> |