mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-11 21:56:47 +02:00
feat(ui): add links to review request targets in issue comments (#8239)
- Add links to review request targets in issue comments - Fix links to ghost users/orgs/teams to be empty Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8239 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
parent
82daae4c7c
commit
7643bdd2b5
11 changed files with 256 additions and 21 deletions
|
@ -46,6 +46,28 @@ func TestIsValidUserID(t *testing.T) {
|
|||
assert.True(t, user_model.IsValidUserID(200))
|
||||
}
|
||||
|
||||
func TestUserLinks(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
assert.Equal(t, "/", user1.DashboardLink())
|
||||
assert.Equal(t, "/user1", user1.HomeLink())
|
||||
assert.Equal(t, "https://try.gitea.io/user1", user1.HTMLURL())
|
||||
assert.Empty(t, user1.OrganisationLink())
|
||||
|
||||
org3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3})
|
||||
assert.Equal(t, "/org/org3/dashboard", org3.DashboardLink())
|
||||
assert.Equal(t, "/org3", org3.HomeLink())
|
||||
assert.Equal(t, "https://try.gitea.io/org3", org3.HTMLURL())
|
||||
assert.Equal(t, "/org/org3", org3.OrganisationLink())
|
||||
|
||||
ghost := user_model.NewGhostUser()
|
||||
assert.Empty(t, ghost.DashboardLink())
|
||||
assert.Empty(t, ghost.HomeLink())
|
||||
assert.Empty(t, ghost.HTMLURL())
|
||||
assert.Empty(t, ghost.OrganisationLink())
|
||||
}
|
||||
|
||||
func TestGetUserFromMap(t *testing.T) {
|
||||
id := int64(200)
|
||||
idMap := map[int64]*user_model.User{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue