Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions routers/web/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ func Forks(ctx *context.Context) {
}

pager := context.NewPagination(int(total), pageSize, page, 5)
ctx.Data["IsForksPage"] = true
ctx.Data["Page"] = pager

ctx.Data["Forks"] = forks
ctx.Data["Repos"] = forks

ctx.HTML(http.StatusOK, tplForks)
}
2 changes: 1 addition & 1 deletion templates/admin/user/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{ctx.Locale.Tr "admin.repositories"}} ({{ctx.Locale.Tr "admin.total" .ReposTotal}})
</h4>
<div class="ui attached segment">
{{template "explore/repo_list" .}}
{{template "shared/repo/list" .}}
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "settings.organization"}} ({{ctx.Locale.Tr "admin.total" .OrgsTotal}})
Expand Down
4 changes: 2 additions & 2 deletions templates/explore/repos.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div role="main" aria-label="{{.Title}}" class="page-content explore repositories">
{{template "explore/navbar" .}}
<div class="ui container">
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "shared/repo/search" .}}
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/org/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{{if .ProfileReadmeContent}}
<div id="readme_profile" class="render-content markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div>
{{end}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "shared/repo/search" .}}
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
</div>

Expand Down
12 changes: 2 additions & 10 deletions templates/repo/forks.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@
<h2 class="ui dividing header">
{{ctx.Locale.Tr "repo.forks"}}
</h2>
<div class="flex-list">
{{range .Forks}}
<div class="flex-item tw-border-0 repo-fork-item">
<span>{{ctx.AvatarUtils.Avatar .Owner}}</span>
<span><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a></span>
</div>
{{end}}
</div>
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
</div>

{{template "base/paginate" .}}
</div>
{{template "base/footer" .}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
{{range .Repos}}
<div class="flex-item">
<div class="flex-item-leading">
{{template "repo/icon" .}}
{{if $.IsForksPage}}
{{ctx.AvatarUtils.Avatar .Owner 24}}
{{else}}
{{template "repo/icon" .}}
{{end}}
</div>
<div class="flex-item-main">
<div class="flex-item-header">
<div class="flex-item-title">
{{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}}
{{if and (or $.IsForksPage $.PageIsExplore $.PageIsProfileStarList) .Owner}}
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
{{end}}
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions templates/user/notification/notification_subscriptions.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
{{end}}
{{else}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "shared/repo/search" .}}
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
{{end}}
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/user/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
{{template "user/dashboard/feeds" .}}
{{else if eq .TabName "stars"}}
<div class="stars">
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "shared/repo/search" .}}
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
</div>
{{else if eq .TabName "following"}}
Expand All @@ -30,8 +30,8 @@
{{else if eq .TabName "organizations"}}
{{template "repo/user_cards" .}}
{{else}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "shared/repo/search" .}}
{{template "shared/repo/list" .}}
{{template "base/paginate" .}}
{{end}}
</div>
Expand Down
11 changes: 7 additions & 4 deletions tests/integration/repo_fork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestRepoForkToOrg(t *testing.T) {

func TestForkListLimitedAndPrivateRepos(t *testing.T) {
defer tests.PrepareTestEnv(t)()
forkItemSelector := ".repo-fork-item"
forkItemSelector := ".flex-item"

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

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

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