Skip to content

Commit 5acba46

Browse files
CirnoTlafriks
andauthoredJun 5, 2020
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 <[email protected]>
1 parent f761a37 commit 5acba46

File tree

7 files changed

+17
-1
lines changed

7 files changed

+17
-1
lines changed
 

‎models/repo.go

+1
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool)
405405
AllowRebaseMerge: allowRebaseMerge,
406406
AllowSquash: allowSquash,
407407
AvatarURL: repo.avatarLink(e),
408+
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
408409
}
409410
}
410411

‎modules/structs/repo.go

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ type Repository struct {
8888
AllowRebaseMerge bool `json:"allow_rebase_explicit"`
8989
AllowSquash bool `json:"allow_squash_merge"`
9090
AvatarURL string `json:"avatar_url"`
91+
Internal bool `json:"internal"`
9192
}
9293

9394
// CreateRepoOption options when creating repository

‎templates/explore/repo_list.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
</a>
1212
{{if .IsPrivate}}
1313
<span class="middle text gold">{{svg "octicon-lock" 16}}</span>
14+
{{else if and (not .IsMirror) (not .IsFork) (.Owner.Visibility.IsPrivate) }}
15+
<span class="text gold">{{svg "octicon-internal-repo" 16}}</span>
1416
{{else if .IsFork}}
1517
<span class="middle">{{svg "octicon-repo-forked" 16}}</span>
1618
{{else if .IsMirror}}

‎templates/repo/header.tmpl

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
{{else}}
1515
{{if .IsPrivate}}
1616
{{svg "octicon-lock" 32}}
17+
{{else if and (not .IsMirror) (not .IsFork) (.Owner)}}
18+
{{if .Owner.Visibility.IsPrivate}}
19+
{{svg "octicon-internal-repo" 32}}
20+
{{else}}
21+
{{svg "octicon-repo" 32}}
22+
{{end}}
1723
{{else if .IsMirror}}
1824
{{svg "octicon-repo-clone" 32}}
1925
{{else if .IsFork}}

‎templates/swagger/v1_json.tmpl

+4
Original file line numberDiff line numberDiff line change
@@ -14056,6 +14056,10 @@
1405614056
"type": "boolean",
1405714057
"x-go-name": "IgnoreWhitespaceConflicts"
1405814058
},
14059+
"internal": {
14060+
"type": "boolean",
14061+
"x-go-name": "Internal"
14062+
},
1405914063
"internal_tracker": {
1406014064
"$ref": "#/definitions/InternalTracker"
1406114065
},

‎templates/user/dashboard/repolist.tmpl

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

‎web_src/js/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -2962,6 +2962,8 @@ function initVueComponents() {
29622962
return `octicon-repo-template${repo.private ? '-private' : ''}`;
29632963
} if (repo.private) {
29642964
return 'octicon-lock';
2965+
} if (repo.internal) {
2966+
return 'octicon-internal-repo';
29652967
}
29662968
return 'octicon-repo';
29672969
}

0 commit comments

Comments
 (0)
Please sign in to comment.