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
5b1aa9f4
Commit
5b1aa9f4
authored
Jun 11, 2021
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various fixes when loading classes
This prepares us for switching to the Zeitwerk autoloader
parent
b01c63af
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
51 additions
and
42 deletions
+51
-42
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+1
-0
app/models/members/last_group_owner_assigner.rb
app/models/members/last_group_owner_assigner.rb
+30
-32
app/serializers/member_serializer.rb
app/serializers/member_serializer.rb
+1
-1
ee/lib/api/group_merge_request_approval_settings.rb
ee/lib/api/group_merge_request_approval_settings.rb
+1
-1
ee/lib/gitlab/subscription_portal/client.rb
ee/lib/gitlab/subscription_portal/client.rb
+1
-1
ee/lib/gitlab/subscription_portal/clients/rest.rb
ee/lib/gitlab/subscription_portal/clients/rest.rb
+1
-1
ee/spec/lib/gitlab/subscription_portal/client_spec.rb
ee/spec/lib/gitlab/subscription_portal/client_spec.rb
+1
-1
ee/spec/lib/gitlab/subscription_portal/clients/rest_spec.rb
ee/spec/lib/gitlab/subscription_portal/clients/rest_spec.rb
+1
-1
lib/api/entities/issue_basic.rb
lib/api/entities/issue_basic.rb
+1
-1
lib/gitlab/database/migration_helpers.rb
lib/gitlab/database/migration_helpers.rb
+1
-1
lib/gitlab/graphql/standard_graphql_error.rb
lib/gitlab/graphql/standard_graphql_error.rb
+10
-0
spec/models/members/last_group_owner_assigner_spec.rb
spec/models/members/last_group_owner_assigner_spec.rb
+1
-1
spec/serializers/member_serializer_spec.rb
spec/serializers/member_serializer_spec.rb
+1
-1
No files found.
.rubocop_manual_todo.yml
View file @
5b1aa9f4
...
...
@@ -1588,6 +1588,7 @@ Gitlab/NamespacedClass:
-
'
app/models/list_user_preference.rb'
-
'
app/models/member.rb'
-
'
app/models/members/group_member.rb'
-
'
app/models/members/last_group_owner_assigner.rb'
-
'
app/models/members/project_member.rb'
-
'
app/models/members_preloader.rb'
-
'
app/models/merge_request.rb'
...
...
app/models/members/last_group_owner_assigner.rb
View file @
5b1aa9f4
# frozen_string_literal: true
module
Members
class
LastGroupOwnerAssigner
def
initialize
(
group
,
members
)
@group
=
group
@members
=
members
end
class
LastGroupOwnerAssigner
def
initialize
(
group
,
members
)
@group
=
group
@members
=
members
end
def
execute
@last_blocked_owner
=
no_owners_in_heirarchy?
&&
group
.
single_blocked_owner?
@group_single_owner
=
owners
.
size
==
1
def
execute
@last_blocked_owner
=
no_owners_in_heirarchy?
&&
group
.
single_blocked_owner?
@group_single_owner
=
owners
.
size
==
1
members
.
each
{
|
member
|
set_last_owner
(
member
)
}
end
members
.
each
{
|
member
|
set_last_owner
(
member
)
}
end
private
private
attr_reader
:group
,
:members
,
:last_blocked_owner
,
:group_single_owner
attr_reader
:group
,
:members
,
:last_blocked_owner
,
:group_single_owner
def
no_owners_in_heirarchy?
owners
.
empty?
end
def
no_owners_in_heirarchy?
owners
.
empty?
end
def
set_last_owner
(
member
)
member
.
last_owner
=
member
.
id
.
in?
(
owner_ids
)
&&
group_single_owner
member
.
last_blocked_owner
=
member
.
id
.
in?
(
blocked_owner_ids
)
&&
last_blocked_owner
end
def
set_last_owner
(
member
)
member
.
last_owner
=
member
.
id
.
in?
(
owner_ids
)
&&
group_single_owner
member
.
last_blocked_owner
=
member
.
id
.
in?
(
blocked_owner_ids
)
&&
last_blocked_owner
end
def
owner_ids
@owner_ids
||=
owners
.
where
(
id:
member_ids
).
ids
end
def
owner_ids
@owner_ids
||=
owners
.
where
(
id:
member_ids
).
ids
end
def
blocked_owner_ids
@blocked_owner_ids
||=
group
.
blocked_owners
.
where
(
id:
member_ids
).
ids
end
def
blocked_owner_ids
@blocked_owner_ids
||=
group
.
blocked_owners
.
where
(
id:
member_ids
).
ids
end
def
member_ids
@members_ids
||=
members
.
pluck
(
:id
)
end
def
member_ids
@members_ids
||=
members
.
pluck
(
:id
)
end
def
owners
@owners
||=
group
.
members_with_parents
.
owners
.
load
end
def
owners
@owners
||=
group
.
members_with_parents
.
owners
.
load
end
end
app/serializers/member_serializer.rb
View file @
5b1aa9f4
...
...
@@ -4,7 +4,7 @@ class MemberSerializer < BaseSerializer
entity
MemberEntity
def
represent
(
members
,
opts
=
{})
Members
::
LastGroupOwnerAssigner
.
new
(
opts
[
:group
],
members
).
execute
unless
opts
[
:source
].
is_a?
(
Project
)
LastGroupOwnerAssigner
.
new
(
opts
[
:group
],
members
).
execute
unless
opts
[
:source
].
is_a?
(
Project
)
super
(
members
,
opts
)
end
...
...
ee/lib/api/group_merge_request_approval_settings.rb
View file @
5b1aa9f4
...
...
@@ -28,7 +28,7 @@ module API
desc
'Update existing merge request approval setting'
do
detail
'This feature is gated by the :group_merge_request_approval_settings_feature_flag'
success
EE
::
API
::
Entities
::
GroupMergeRequestApprovalSetting
success
::
API
::
Entities
::
GroupMergeRequestApprovalSetting
end
params
do
optional
:allow_author_approval
,
type:
Boolean
,
desc:
'Allow authors to self-approve merge requests'
...
...
ee/lib/gitlab/subscription_portal/client.rb
View file @
5b1aa9f4
...
...
@@ -3,7 +3,7 @@
module
Gitlab
module
SubscriptionPortal
class
Client
include
SubscriptionPortal
::
Clients
::
R
EST
include
SubscriptionPortal
::
Clients
::
R
est
include
SubscriptionPortal
::
Clients
::
Graphql
ResponseError
=
Class
.
new
(
StandardError
)
...
...
ee/lib/gitlab/subscription_portal/clients/rest.rb
View file @
5b1aa9f4
...
...
@@ -3,7 +3,7 @@
module
Gitlab
module
SubscriptionPortal
module
Clients
module
R
EST
module
R
est
extend
ActiveSupport
::
Concern
class_methods
do
...
...
ee/spec/lib/gitlab/subscription_portal/client_spec.rb
View file @
5b1aa9f4
...
...
@@ -6,5 +6,5 @@ RSpec.describe Gitlab::SubscriptionPortal::Client do
subject
{
described_class
}
it
{
is_expected
.
to
include_module
Gitlab
::
SubscriptionPortal
::
Clients
::
Graphql
}
it
{
is_expected
.
to
include_module
Gitlab
::
SubscriptionPortal
::
Clients
::
R
EST
}
it
{
is_expected
.
to
include_module
Gitlab
::
SubscriptionPortal
::
Clients
::
R
est
}
end
ee/spec/lib/gitlab/subscription_portal/clients/rest_spec.rb
View file @
5b1aa9f4
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
SubscriptionPortal
::
Clients
::
R
EST
do
RSpec
.
describe
Gitlab
::
SubscriptionPortal
::
Clients
::
R
est
do
let
(
:client
)
{
Gitlab
::
SubscriptionPortal
::
Client
}
let
(
:http_response
)
{
nil
}
let
(
:http_method
)
{
:post
}
...
...
lib/api/entities/issue_basic.rb
View file @
5b1aa9f4
...
...
@@ -23,7 +23,7 @@ module API
expose
:issue_type
,
as: :type
,
format_with: :upcase
,
documentation:
{
type:
"String"
,
desc:
"One of
#{
Issue
.
issue_types
.
keys
.
map
(
&
:upcase
)
}
"
}
documentation:
{
type:
"String"
,
desc:
"One of
#{
::
Issue
.
issue_types
.
keys
.
map
(
&
:upcase
)
}
"
}
expose
:assignee
,
using:
::
API
::
Entities
::
UserBasic
do
|
issue
|
issue
.
assignees
.
first
...
...
lib/gitlab/database/migration_helpers.rb
View file @
5b1aa9f4
...
...
@@ -5,7 +5,7 @@ module Gitlab
module
MigrationHelpers
include
Migrations
::
BackgroundMigrationHelpers
include
DynamicModelHelpers
include
Migrations
::
RenameTableHelpers
include
RenameTableHelpers
# https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
MAX_IDENTIFIER_NAME_LENGTH
=
63
...
...
lib/gitlab/graphql.rb
→
lib/gitlab/graphql
/standard_graphql_error
.rb
View file @
5b1aa9f4
# frozen_string_literal: true
# rubocop:disable Cop/CustomErrorClass
module
Gitlab
module
Graphql
StandardGraphqlError
=
Class
.
new
(
StandardError
)
class
StandardGraphqlError
<
StandardError
end
end
end
spec/models/members/last_group_owner_assigner_spec.rb
View file @
5b1aa9f4
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
Members
::
LastGroupOwnerAssigner
do
RSpec
.
describe
LastGroupOwnerAssigner
do
describe
"#execute"
do
let_it_be
(
:user
,
reload:
true
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
...
...
spec/serializers/member_serializer_spec.rb
View file @
5b1aa9f4
...
...
@@ -42,7 +42,7 @@ RSpec.describe MemberSerializer do
it_behaves_like
'members.json'
it
'does not invoke group owner assignment'
do
expect
(
Members
::
LastGroupOwnerAssigner
).
not_to
receive
(
:new
)
expect
(
LastGroupOwnerAssigner
).
not_to
receive
(
:new
)
representation
end
...
...
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