Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release/v1.16' into release/dc…
Browse files Browse the repository at this point in the history
…s/v1.16
  • Loading branch information
richmahn committed Mar 4, 2022
2 parents dbc5c50 + b811b81 commit c9be534
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/repo.go
Expand Up @@ -153,7 +153,7 @@ func getRepoAssignees(ctx context.Context, repo *repo_model.Repository) (_ []*us
userIDs := make([]int64, 0, 10)
if err = e.Table("access").
Where("repo_id = ? AND mode >= ?", repo.ID, perm.AccessModeWrite).
Select("id").
Select("user_id").
Find(&userIDs); err != nil {
return nil, err
}
Expand Down
18 changes: 18 additions & 0 deletions models/repo_test.go
Expand Up @@ -167,3 +167,21 @@ func TestLinkedRepository(t *testing.T) {
})
}
}

func TestRepoAssignees(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())

repo2 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
users, err := GetRepoAssignees(repo2)
assert.NoError(t, err)
assert.Len(t, users, 1)
assert.Equal(t, users[0].ID, int64(2))

repo21 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 21}).(*repo_model.Repository)
users, err = GetRepoAssignees(repo21)
assert.NoError(t, err)
assert.Len(t, users, 3)
assert.Equal(t, users[0].ID, int64(15))
assert.Equal(t, users[1].ID, int64(18))
assert.Equal(t, users[2].ID, int64(16))
}
2 changes: 1 addition & 1 deletion templates/admin/dashboard.tmpl
Expand Up @@ -5,7 +5,7 @@
{{template "base/alert" .}}
{{if .NeedUpdate}}
<div class="ui negative message flash-error">
<p>{{.i18n.Tr "admin.dashboard.new_version_hint" (.RemoteVersion | Str2html) (AppVer | Str2html)}}</p>
<p>{{(.i18n.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | Str2html}}</p>
</div>
{{end}}
<h4 class="ui top attached header">
Expand Down

0 comments on commit c9be534

Please sign in to comment.