Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/structs/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions templates/explore/repo_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</a>
{{if .IsPrivate}}
<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}}
<span class="middle">{{svg "octicon-repo-forked" 16}}</span>
{{else if .IsMirror}}
Expand Down
6 changes: 6 additions & 0 deletions templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 4 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14056,6 +14056,10 @@
"type": "boolean",
"x-go-name": "IgnoreWhitespaceConflicts"
},
"internal": {
"type": "boolean",
"x-go-name": "Internal"
},
"internal_tracker": {
"$ref": "#/definitions/InternalTracker"
},
Expand Down
2 changes: 1 addition & 1 deletion templates/user/dashboard/repolist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</div>
<div class="ui attached table segment">
<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">
<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>
Expand Down
2 changes: 2 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,8 @@ function initVueComponents() {
return `octicon-repo-template${repo.private ? '-private' : ''}`;
} if (repo.private) {
return 'octicon-lock';
} if (repo.internal) {
return 'octicon-internal-repo';
}
return 'octicon-repo';
}
Expand Down