remove no-description

This commit is contained in:
wxiaoguang 2024-04-20 11:33:02 +08:00
parent 3939146675
commit 8275653379
3 changed files with 2 additions and 33 deletions

View File

@ -1193,7 +1193,6 @@ action.blocked_user = Cannot perform action because you are blocked by the repos
download_archive = Download Repository
more_operations = More Operations
no_desc = No Description
quick_guide = Quick Guide
clone_this_repo = Clone this repository
cite_this_repo = Cite this repository

View File

@ -7,12 +7,8 @@
{{if and (not .HideRepoInfo) (not .IsBlame)}}
<div class="repo-description gt-word-break">
{{- $description := .Repository.DescriptionHTML ctx -}}
{{- if $description -}}
{{- $description | RenderCodeBlock -}}
{{- else if .IsRepositoryAdmin -}}
<span class="no-description tw-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>
{{- end -}}
{{- if .Repository.Website}}<a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end -}}
{{if $description}}{{$description | RenderCodeBlock}}{{end}}
{{if .Repository.Website}}<a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}
</div>
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
{{/* it should match the code in issue-home.js */}}

View File

@ -28,11 +28,9 @@ func TestViewRepo(t *testing.T) {
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
noDescription := htmlDoc.doc.Find(".repo-description").Children()
repoTopics := htmlDoc.doc.Find("#repo-topics").Children()
repoSummary := htmlDoc.doc.Find(".repository-summary").Children()
assert.True(t, noDescription.HasClass("no-description"))
assert.True(t, repoTopics.HasClass("repo-topic"))
assert.True(t, repoSummary.HasClass("repository-menu"))
@ -177,30 +175,6 @@ func TestViewRepoWithSymlinks(t *testing.T) {
assert.Equal(t, "link_link: svg octicon-file-symlink-file", items[4])
}
// TestViewAsRepoAdmin tests PR #2167
func TestViewAsRepoAdmin(t *testing.T) {
for user, expectedNoDescription := range map[string]bool{
"user2": true,
"user4": false,
} {
defer tests.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-description").Children()
repoTopics := htmlDoc.doc.Find("#repo-topics").Children()
repoSummary := htmlDoc.doc.Find(".repository-summary").Children()
assert.Equal(t, expectedNoDescription, noDescription.HasClass("no-description"))
assert.True(t, repoTopics.HasClass("repo-topic"))
assert.True(t, repoSummary.HasClass("repository-menu"))
}
}
// TestViewFileInRepo repo description, topics and summary should not be displayed when viewing a file
func TestViewFileInRepo(t *testing.T) {
defer tests.PrepareTestEnv(t)()