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
350b0578
Commit
350b0578
authored
Sep 16, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert namespace method group?
into group_namespace?
parent
a66880a3
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
21 additions
and
21 deletions
+21
-21
app/models/namespace.rb
app/models/namespace.rb
+4
-4
app/services/clusters/agents/refresh_authorization_service.rb
...services/clusters/agents/refresh_authorization_service.rb
+1
-1
ee/app/helpers/billing_plans_helper.rb
ee/app/helpers/billing_plans_helper.rb
+2
-2
ee/app/helpers/ee/gitlab_routing_helper.rb
ee/app/helpers/ee/gitlab_routing_helper.rb
+1
-1
ee/app/helpers/ee/user_callouts_helper.rb
ee/app/helpers/ee/user_callouts_helper.rb
+1
-1
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+1
-1
ee/app/models/ee/namespace/root_storage_statistics.rb
ee/app/models/ee/namespace/root_storage_statistics.rb
+1
-1
ee/app/models/namespace_statistics.rb
ee/app/models/namespace_statistics.rb
+4
-4
ee/lib/ee/api/entities/issue.rb
ee/lib/ee/api/entities/issue.rb
+1
-1
ee/lib/gitlab/subscription_portal/clients/graphql.rb
ee/lib/gitlab/subscription_portal/clients/graphql.rb
+1
-1
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+1
-1
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+1
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+2
-2
No files found.
app/models/namespace.rb
View file @
350b0578
...
...
@@ -247,13 +247,13 @@ class Namespace < ApplicationRecord
end
def
kind
return
'group'
if
group?
return
'group'
if
group
_namespace
?
return
'project'
if
project_namespace?
'user'
# defaults to user
end
def
group?
def
group
_namespace
?
type
==
Group
.
sti_name
end
...
...
@@ -263,7 +263,7 @@ class Namespace < ApplicationRecord
def
user_namespace?
# That last bit ensures we're considered a user namespace as a default
type
.
nil?
||
type
==
Namespaces
::
UserNamespace
.
sti_name
||
!
(
group?
||
project_namespace?
)
type
.
nil?
||
type
==
Namespaces
::
UserNamespace
.
sti_name
||
!
(
group
_namespace
?
||
project_namespace?
)
end
def
owner_required?
...
...
@@ -549,7 +549,7 @@ class Namespace < ApplicationRecord
if
user_namespace?
errors
.
add
(
:parent_id
,
_
(
'cannot not be used for user namespace'
))
elsif
group?
elsif
group
_namespace
?
errors
.
add
(
:parent_id
,
_
(
'user namespace cannot be the parent of another namespace'
))
if
parent
.
user_namespace?
end
end
...
...
app/services/clusters/agents/refresh_authorization_service.rb
View file @
350b0578
...
...
@@ -99,7 +99,7 @@ module Clusters
end
def
group_root_ancestor?
root_ancestor
.
group?
root_ancestor
.
group
_namespace
?
end
end
end
...
...
ee/app/helpers/billing_plans_helper.rb
View file @
350b0578
...
...
@@ -59,7 +59,7 @@ module BillingPlansHelper
# This can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/298715 is complete.
return
false
unless
current_user
.
last_name
.
present?
namespace
.
group?
&&
(
namespace
.
actual_plan_name
==
Plan
::
FREE
||
namespace
.
trial_active?
)
namespace
.
group
_namespace
?
&&
(
namespace
.
actual_plan_name
==
Plan
::
FREE
||
namespace
.
trial_active?
)
end
def
plan_feature_list
(
plan
)
...
...
@@ -163,7 +163,7 @@ module BillingPlansHelper
end
def
billable_seats_href
(
namespace
)
return
unless
namespace
.
group?
return
unless
namespace
.
group
_namespace
?
group_usage_quotas_path
(
namespace
,
anchor:
'seats-quota-tab'
)
end
...
...
ee/app/helpers/ee/gitlab_routing_helper.rb
View file @
350b0578
...
...
@@ -71,7 +71,7 @@ module EE
end
def
usage_quotas_path
(
namespace
,
*
args
)
if
namespace
.
group?
if
namespace
.
group
_namespace
?
group_usage_quotas_path
(
namespace
,
*
args
)
else
profile_usage_quotas_path
(
*
args
)
...
...
ee/app/helpers/ee/user_callouts_helper.rb
View file @
350b0578
...
...
@@ -92,7 +92,7 @@ module EE
return
false
unless
namespace
.
bronze_plan?
return
false
if
user_dismissed?
(
EOA_BRONZE_PLAN_BANNER
)
(
namespace
.
group
?
&&
namespace
.
has_owner?
(
current_user
.
id
))
||
!
namespace
.
group
?
(
namespace
.
group
_namespace?
&&
namespace
.
has_owner?
(
current_user
.
id
))
||
!
namespace
.
group_namespace
?
end
override
:dismiss_two_factor_auth_recovery_settings_check
...
...
ee/app/models/ee/namespace.rb
View file @
350b0578
...
...
@@ -393,7 +393,7 @@ module EE
end
def
free_personal?
user?
&&
!
paid?
user
_namespace
?
&&
!
paid?
end
def
use_elasticsearch?
...
...
ee/app/models/ee/namespace/root_storage_statistics.rb
View file @
350b0578
...
...
@@ -23,7 +23,7 @@ module EE
# the query. If this changes in the future and we add some sort of resource to
# users that it's store in NamespaceStatistics, we will need to remove this
# guard clause.
return
{}
unless
namespace
.
group?
return
{}
unless
namespace
.
group
_namespace
?
from_namespace_statistics
.
take
.
slice
(
*
NAMESPACE_STATISTICS_ATTRIBUTES
)
end
...
...
ee/app/models/namespace_statistics.rb
View file @
350b0578
...
...
@@ -14,13 +14,13 @@ class NamespaceStatistics < ApplicationRecord
after_save
:update_root_storage_statistics
,
if: :saved_change_to_storage_size?
after_destroy
:update_root_storage_statistics
delegate
:group?
,
to: :namespace
delegate
:group
_namespace
?
,
to: :namespace
COLUMNS_TO_REFRESH
=
[
:wiki_size
].
freeze
def
refresh!
(
only:
[])
return
if
Gitlab
::
Database
.
read_only?
return
unless
group?
return
unless
group
_namespace
?
COLUMNS_TO_REFRESH
.
each
do
|
column
|
if
only
.
empty?
||
only
.
include?
(
column
)
...
...
@@ -44,11 +44,11 @@ class NamespaceStatistics < ApplicationRecord
private
def
group_wiki_available?
group?
&&
namespace
.
feature_available?
(
:group_wikis
)
group
_namespace
?
&&
namespace
.
feature_available?
(
:group_wikis
)
end
def
update_root_storage_statistics
return
unless
group?
return
unless
group
_namespace
?
run_after_commit
do
Namespaces
::
ScheduleAggregationWorker
.
perform_async
(
namespace
.
id
)
...
...
ee/lib/ee/api/entities/issue.rb
View file @
350b0578
...
...
@@ -7,7 +7,7 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
with_options
if:
->
(
issue
,
_
)
{
issue
.
project
.
namespace
.
group?
&&
issue
.
project
.
namespace
.
feature_available?
(
:epics
)
}
do
with_options
if:
->
(
issue
,
_
)
{
issue
.
project
.
namespace
.
group
_namespace
?
&&
issue
.
project
.
namespace
.
feature_available?
(
:epics
)
}
do
expose
:epic_iid
do
|
issue
|
authorized_epic_for
(
issue
)
&
.
iid
end
...
...
ee/lib/gitlab/subscription_portal/clients/graphql.rb
View file @
350b0578
...
...
@@ -134,7 +134,7 @@ module Gitlab
plan:
namespace
.
actual_plan_name
,
trial:
!!
namespace
.
trial?
,
kind:
namespace
.
kind
,
membersCountWithDescendants:
namespace
.
group?
?
namespace
.
users_with_descendants
.
count
:
nil
membersCountWithDescendants:
namespace
.
group
_namespace
?
?
namespace
.
users_with_descendants
.
count
:
nil
}
end
...
...
ee/spec/models/ee/namespace_spec.rb
View file @
350b0578
...
...
@@ -74,7 +74,7 @@ RSpec.describe Namespace do
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:user?
).
and_return
(
user
)
allow
(
namespace
).
to
receive
(
:user
_namespace
?
).
and_return
(
user
)
allow
(
namespace
).
to
receive
(
:paid?
).
and_return
(
paid
)
end
...
...
lib/gitlab/auth.rb
View file @
350b0578
...
...
@@ -283,7 +283,7 @@ module Gitlab
token_handler
=
Gitlab
::
LfsToken
.
new
(
actor
)
authentication_abilities
=
if
token_handler
.
user
_namespace
?
if
token_handler
.
user?
read_write_project_authentication_abilities
elsif
token_handler
.
deploy_key_pushable?
(
project
)
read_write_authentication_abilities
...
...
spec/models/namespace_spec.rb
View file @
350b0578
...
...
@@ -175,7 +175,7 @@ RSpec.describe Namespace do
it
'is valid'
do
expect
(
namespace
).
to
be_a
(
Group
)
expect
(
namespace
.
kind
).
to
eq
(
'group'
)
expect
(
namespace
.
group?
).
to
be_truthy
expect
(
namespace
.
group
_namespace
?
).
to
be_truthy
end
end
...
...
@@ -1558,7 +1558,7 @@ RSpec.describe Namespace do
end
end
describe
'#user?'
do
describe
'#user
_namespace
?'
do
subject
{
namespace
.
user_namespace?
}
context
'when type is a user'
do
...
...
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