Add internal-repo octicon for public repos of private org (#11529)

* Show multiple octicons on repo list

* fix mixed spaces/tabs

* Internal repo octicon

* show internal icon in dashboard repolist

* swagger

* fix icon for normal repo on repo page

* don't expose owner visibility directly; provide internal in repo api

* fix icons for forks and mirrors

Co-authored-by: Lauris BH <lauris@nix.lv>
tokarchuk/v1.17
Cirno the Strongest 5 years ago committed by GitHub
parent f761a37a0f
commit 5acba4609a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      models/repo.go
  2. 1
      modules/structs/repo.go
  3. 2
      templates/explore/repo_list.tmpl
  4. 6
      templates/repo/header.tmpl
  5. 4
      templates/swagger/v1_json.tmpl
  6. 2
      templates/user/dashboard/repolist.tmpl
  7. 2
      web_src/js/index.js

@ -405,6 +405,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool)
AllowRebaseMerge: allowRebaseMerge, AllowRebaseMerge: allowRebaseMerge,
AllowSquash: allowSquash, AllowSquash: allowSquash,
AvatarURL: repo.avatarLink(e), AvatarURL: repo.avatarLink(e),
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
} }
} }

@ -88,6 +88,7 @@ type Repository struct {
AllowRebaseMerge bool `json:"allow_rebase_explicit"` AllowRebaseMerge bool `json:"allow_rebase_explicit"`
AllowSquash bool `json:"allow_squash_merge"` AllowSquash bool `json:"allow_squash_merge"`
AvatarURL string `json:"avatar_url"` AvatarURL string `json:"avatar_url"`
Internal bool `json:"internal"`
} }
// CreateRepoOption options when creating repository // CreateRepoOption options when creating repository

@ -11,6 +11,8 @@
</a> </a>
{{if .IsPrivate}} {{if .IsPrivate}}
<span class="middle text gold">{{svg "octicon-lock" 16}}</span> <span class="middle text gold">{{svg "octicon-lock" 16}}</span>
{{else if and (not .IsMirror) (not .IsFork) (.Owner.Visibility.IsPrivate) }}
<span class="text gold">{{svg "octicon-internal-repo" 16}}</span>
{{else if .IsFork}} {{else if .IsFork}}
<span class="middle">{{svg "octicon-repo-forked" 16}}</span> <span class="middle">{{svg "octicon-repo-forked" 16}}</span>
{{else if .IsMirror}} {{else if .IsMirror}}

@ -14,6 +14,12 @@
{{else}} {{else}}
{{if .IsPrivate}} {{if .IsPrivate}}
{{svg "octicon-lock" 32}} {{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}} {{else if .IsMirror}}
{{svg "octicon-repo-clone" 32}} {{svg "octicon-repo-clone" 32}}
{{else if .IsFork}} {{else if .IsFork}}

@ -14056,6 +14056,10 @@
"type": "boolean", "type": "boolean",
"x-go-name": "IgnoreWhitespaceConflicts" "x-go-name": "IgnoreWhitespaceConflicts"
}, },
"internal": {
"type": "boolean",
"x-go-name": "Internal"
},
"internal_tracker": { "internal_tracker": {
"$ref": "#/definitions/InternalTracker" "$ref": "#/definitions/InternalTracker"
}, },

@ -101,7 +101,7 @@
</div> </div>
<div class="ui attached table segment"> <div class="ui attached table segment">
<ul class="repo-owner-name-list"> <ul class="repo-owner-name-list">
<li v-for="repo in repos" :class="{'private': repo.private}"> <li v-for="repo in repos" :class="{'private': repo.private || repo.internal}">
<a :href="suburl + '/' + repo.full_name"> <a :href="suburl + '/' + repo.full_name">
<svg :class="'svg ' + repoClass(repo)" width="16" height="16" aria-hidden="true"><use :xlink:href="'#' + repoClass(repo)" /></svg> <svg :class="'svg ' + repoClass(repo)" width="16" height="16" aria-hidden="true"><use :xlink:href="'#' + repoClass(repo)" /></svg>
<strong class="text truncate item-name">${repo.full_name}</strong> <strong class="text truncate item-name">${repo.full_name}</strong>

@ -2962,6 +2962,8 @@ function initVueComponents() {
return `octicon-repo-template${repo.private ? '-private' : ''}`; return `octicon-repo-template${repo.private ? '-private' : ''}`;
} if (repo.private) { } if (repo.private) {
return 'octicon-lock'; return 'octicon-lock';
} if (repo.internal) {
return 'octicon-internal-repo';
} }
return 'octicon-repo'; return 'octicon-repo';
} }

Loading…
Cancel
Save