Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
27570b9c
Commit
27570b9c
authored
Jan 19, 2022
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace owner check with team owner method check
Add tests
parent
68755b38
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
app/models/issue.rb
app/models/issue.rb
+1
-1
app/models/project_team.rb
app/models/project_team.rb
+4
-0
spec/models/project_team_spec.rb
spec/models/project_team_spec.rb
+26
-0
No files found.
app/models/issue.rb
View file @
27570b9c
...
...
@@ -584,7 +584,7 @@ class Issue < ApplicationRecord
def
readable_by?
(
user
)
if
user
.
can_read_all_resources?
true
elsif
project
.
owner
==
user
elsif
project
.
personal?
&&
project
.
team
.
owner?
(
user
)
true
elsif
confidential?
&&
!
assignee_or_author?
(
user
)
project
.
team
.
member?
(
user
,
Gitlab
::
Access
::
REPORTER
)
...
...
app/models/project_team.rb
View file @
27570b9c
...
...
@@ -107,6 +107,10 @@ class ProjectTeam
end
end
def
owner?
(
user
)
owners
.
include?
(
user
)
end
def
import
(
source_project
,
current_user
=
nil
)
target_project
=
project
...
...
spec/models/project_team_spec.rb
View file @
27570b9c
...
...
@@ -77,6 +77,32 @@ RSpec.describe ProjectTeam do
end
end
describe
'owner methods'
do
context
'personal project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:owner
)
{
project
.
owner
}
specify
{
expect
(
project
.
team
.
owners
).
to
contain_exactly
(
owner
)
}
specify
{
expect
(
project
.
team
.
owner?
(
owner
)).
to
be_truthy
}
end
context
'group project'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:user1
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
before
do
group
.
add_owner
(
user1
)
group
.
add_owner
(
user2
)
end
specify
{
expect
(
project
.
team
.
owners
).
to
contain_exactly
(
user1
,
user2
)
}
specify
{
expect
(
project
.
team
.
owner?
(
user1
)).
to
be_truthy
}
specify
{
expect
(
project
.
team
.
owner?
(
user2
)).
to
be_truthy
}
end
end
describe
'#fetch_members'
do
context
'personal project'
do
let
(
:project
)
{
create
(
:project
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment