mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-26 04:03:48 +00: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
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package organization_test
|
||||
|
@ -15,14 +16,33 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTeam_IsOwnerTeam(t *testing.T) {
|
||||
func TestTeam(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 1})
|
||||
assert.True(t, team.IsOwnerTeam())
|
||||
owners := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 1})
|
||||
assert.Equal(t, int64(3), owners.GetOrg(db.DefaultContext).ID)
|
||||
assert.Equal(t, "/org/org3/teams/Owners", owners.Link(db.DefaultContext))
|
||||
assert.False(t, owners.IsGhost())
|
||||
assert.True(t, owners.IsOwnerTeam())
|
||||
|
||||
team = unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 2})
|
||||
assert.False(t, team.IsOwnerTeam())
|
||||
team1 := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 2})
|
||||
assert.Equal(t, int64(3), team1.GetOrg(db.DefaultContext).ID)
|
||||
assert.Equal(t, "/org/org3/teams/team1", team1.Link(db.DefaultContext))
|
||||
assert.False(t, team1.IsGhost())
|
||||
assert.False(t, team1.IsOwnerTeam())
|
||||
|
||||
ghost := organization.NewGhostTeam()
|
||||
assert.Equal(t, int64(-1), ghost.ID)
|
||||
assert.Equal(t, int64(-1), ghost.GetOrg(db.DefaultContext).ID)
|
||||
assert.Empty(t, ghost.Link(db.DefaultContext))
|
||||
assert.True(t, ghost.IsGhost())
|
||||
assert.False(t, ghost.IsOwnerTeam())
|
||||
|
||||
ghosted := organization.Team{ID: 10, Name: "Ghosted"}
|
||||
assert.Equal(t, int64(-1), ghosted.GetOrg(db.DefaultContext).ID)
|
||||
assert.Empty(t, ghosted.Link(db.DefaultContext))
|
||||
assert.False(t, ghosted.IsGhost())
|
||||
assert.False(t, ghosted.IsOwnerTeam())
|
||||
}
|
||||
|
||||
func TestTeam_IsMember(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue