diff --git a/models/repo.go b/models/repo.go index dceeeb89e90..fd2e75a0ea3 100644 --- a/models/repo.go +++ b/models/repo.go @@ -405,6 +405,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool) AllowRebaseMerge: allowRebaseMerge, AllowSquash: allowSquash, AvatarURL: repo.avatarLink(e), + Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, } } diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 832d330e749..2ff1a1ec267 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -88,6 +88,7 @@ type Repository struct { AllowRebaseMerge bool `json:"allow_rebase_explicit"` AllowSquash bool `json:"allow_squash_merge"` AvatarURL string `json:"avatar_url"` + Internal bool `json:"internal"` } // CreateRepoOption options when creating repository diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index 37bd38c5fae..61ef056afc3 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -11,6 +11,8 @@ {{if .IsPrivate}} {{svg "octicon-lock" 16}} + {{else if and (not .IsMirror) (not .IsFork) (.Owner.Visibility.IsPrivate) }} + {{svg "octicon-internal-repo" 16}} {{else if .IsFork}} {{svg "octicon-repo-forked" 16}} {{else if .IsMirror}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 4daaa201d07..2faaafa4420 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -14,6 +14,12 @@ {{else}} {{if .IsPrivate}} {{svg "octicon-lock" 32}} + {{else if and (not .IsMirror) (not .IsFork) (.Owner)}} + {{if .Owner.Visibility.IsPrivate}} + {{svg "octicon-internal-repo" 32}} + {{else}} + {{svg "octicon-repo" 32}} + {{end}} {{else if .IsMirror}} {{svg "octicon-repo-clone" 32}} {{else if .IsFork}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d90fafd75fe..456d41b9d48 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -14056,6 +14056,10 @@ "type": "boolean", "x-go-name": "IgnoreWhitespaceConflicts" }, + "internal": { + "type": "boolean", + "x-go-name": "Internal" + }, "internal_tracker": { "$ref": "#/definitions/InternalTracker" }, diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index 93dda77d24a..4bae23ab1b0 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -101,7 +101,7 @@