Skip to content

Commit 19c0691

Browse files
committed
improvements
1 parent aa2e222 commit 19c0691

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

routers/web/explore/repo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func Repos(ctx *context.Context) {
151151
ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage
152152
ctx.Data["Title"] = ctx.Tr("explore")
153153
ctx.Data["PageIsExplore"] = true
154+
ctx.Data["ShowOwnerOnList"] = true
154155
ctx.Data["PageIsExploreRepositories"] = true
155156
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
156157

routers/web/repo/view.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ func Forks(ctx *context.Context) {
395395

396396
pager := context.NewPagination(int(total), pageSize, page, 5)
397397
ctx.Data["IsForksPage"] = true
398+
ctx.Data["ShowOwnerOnList"] = true
398399
ctx.Data["Page"] = pager
399400
ctx.Data["Repos"] = forks
400401

routers/web/user/profile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
197197
total = int(count)
198198
case "stars":
199199
ctx.Data["PageIsProfileStarList"] = true
200+
ctx.Data["ShowOwnerOnList"] = true
200201
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
201202
ListOptions: db.ListOptions{
202203
PageSize: pagingNum,

templates/repo/forks.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{template "base/head" .}}
22
<div role="main" aria-label="{{.Title}}" class="page-content repository forks">
33
{{template "repo/header" .}}
4-
<div class="ui container">
4+
<div class="ui container fork-list">
55
<h2 class="ui dividing header">
66
{{ctx.Locale.Tr "repo.forks"}}
77
</h2>

templates/shared/repo/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="flex-item-main">
1212
<div class="flex-item-header">
1313
<div class="flex-item-title">
14-
{{if and (or $.IsForksPage $.PageIsExplore $.PageIsProfileStarList) .Owner}}
14+
{{if and $.ShowOwnerOnList .Owner}}
1515
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
1616
{{end}}
1717
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>

tests/integration/repo_fork_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestRepoForkToOrg(t *testing.T) {
8484

8585
func TestForkListLimitedAndPrivateRepos(t *testing.T) {
8686
defer tests.PrepareTestEnv(t)()
87-
forkItemSelector := ".flex-item"
87+
forkItemSelector := ".fork-list .flex-item"
8888

8989
user1Sess := loginUser(t, "user1")
9090
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user1"})
@@ -112,8 +112,7 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
112112
req := NewRequest(t, "GET", "/user2/repo1/forks")
113113
resp := MakeRequest(t, req, http.StatusOK)
114114
htmlDoc := NewHTMLParser(t, resp.Body)
115-
// current repository will also use class "flex-item" so we need to subtract 1
116-
assert.Equal(t, 0, htmlDoc.Find(forkItemSelector).Length()-1)
115+
assert.Equal(t, 0, htmlDoc.Find(forkItemSelector).Length())
117116
})
118117

119118
t.Run("Logged in", func(t *testing.T) {
@@ -123,13 +122,11 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
123122
resp := user1Sess.MakeRequest(t, req, http.StatusOK)
124123
htmlDoc := NewHTMLParser(t, resp.Body)
125124
// since user1 is an admin, he can get both of the forked repositories
126-
// current repository will also use class "flex-item" so we need to subtract 1
127-
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length()-1)
125+
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length())
128126

129127
assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
130128
resp = user1Sess.MakeRequest(t, req, http.StatusOK)
131129
htmlDoc = NewHTMLParser(t, resp.Body)
132-
// current repository will also use class "flex-item" so we need to subtract 1
133-
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length()-1)
130+
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length())
134131
})
135132
}

0 commit comments

Comments
 (0)