Skip to content

Commit 5f4a40c

Browse files
gabrielsimoeszeripath
authored andcommitted
Revert #3711 overwrite of only show "No Description" to repo admins #2167 (#5836)
Revert #3711 overwrite of only show "No Description" to repo admins #2167 and add tests to prevent accidental overwrite again.
1 parent 182a6d6 commit 5f4a40c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

integrations/repo_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,23 @@ func TestViewRepoWithSymlinks(t *testing.T) {
9999
assert.Equal(t, items[3], "link_hi: octicon octicon-file-symlink-file")
100100
assert.Equal(t, items[4], "link_link: octicon octicon-file-symlink-file")
101101
}
102+
103+
// TestViewAsRepoAdmin tests PR #2167
104+
func TestViewAsRepoAdmin(t *testing.T) {
105+
for user, expectedNoDescription := range map[string]bool{
106+
"user2": true,
107+
"user3": false,
108+
} {
109+
prepareTestEnv(t)
110+
111+
session := loginUser(t, user)
112+
113+
req := NewRequest(t, "GET", "/user2/repo1.git")
114+
resp := session.MakeRequest(t, req, http.StatusOK)
115+
116+
htmlDoc := NewHTMLParser(t, resp.Body)
117+
noDescription := htmlDoc.doc.Find("#repo-desc").Children()
118+
119+
assert.Equal(t, expectedNoDescription, noDescription.HasClass("no-description"))
120+
}
121+
}

templates/repo/home.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{template "base/alert" .}}
66
<div class="ui repo-description">
77
<div id="repo-desc">
8-
{{if .Repository.DescriptionHTML}}<span class="description has-emoji">{{.Repository.DescriptionHTML}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
8+
{{if .Repository.DescriptionHTML}}<span class="description has-emoji">{{.Repository.DescriptionHTML}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
99
<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
1010
</div>
1111
{{if .RepoSearchEnabled}}

0 commit comments

Comments
 (0)