Skip to content

Commit

Permalink
Revert #3711 overwrite of only show "No Description" to repo admins #…
Browse files Browse the repository at this point in the history
…2167 (#5836)

Revert #3711 overwrite of only show "No Description" to repo admins  #2167 and add tests to prevent accidental overwrite again.
  • Loading branch information
gabrielsimoes authored and zeripath committed Jan 27, 2019
1 parent 182a6d6 commit 5f4a40c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions integrations/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,23 @@ func TestViewRepoWithSymlinks(t *testing.T) {
assert.Equal(t, items[3], "link_hi: octicon octicon-file-symlink-file")
assert.Equal(t, items[4], "link_link: octicon octicon-file-symlink-file")
}

// TestViewAsRepoAdmin tests PR #2167
func TestViewAsRepoAdmin(t *testing.T) {
for user, expectedNoDescription := range map[string]bool{
"user2": true,
"user3": false,
} {
prepareTestEnv(t)

session := loginUser(t, user)

req := NewRequest(t, "GET", "/user2/repo1.git")
resp := session.MakeRequest(t, req, http.StatusOK)

htmlDoc := NewHTMLParser(t, resp.Body)
noDescription := htmlDoc.doc.Find("#repo-desc").Children()

assert.Equal(t, expectedNoDescription, noDescription.HasClass("no-description"))
}
}
2 changes: 1 addition & 1 deletion templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{template "base/alert" .}}
<div class="ui repo-description">
<div id="repo-desc">
{{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}}
{{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}}
<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
</div>
{{if .RepoSearchEnabled}}
Expand Down

0 comments on commit 5f4a40c

Please sign in to comment.