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
3383cf0a
Commit
3383cf0a
authored
Feb 06, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EE] Reduce remaining diff with CE in app/services
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
410789ad
Changes
68
Hide whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
451 additions
and
238 deletions
+451
-238
app/helpers/mirror_helper.rb
app/helpers/mirror_helper.rb
+2
-0
app/services/applications/create_service.rb
app/services/applications/create_service.rb
+5
-5
app/services/base_count_service.rb
app/services/base_count_service.rb
+2
-2
app/services/boards/issues/create_service.rb
app/services/boards/issues/create_service.rb
+2
-2
app/services/boards/lists/list_service.rb
app/services/boards/lists/list_service.rb
+2
-2
app/services/emails/base_service.rb
app/services/emails/base_service.rb
+3
-2
app/services/emails/create_service.rb
app/services/emails/create_service.rb
+6
-7
app/services/emails/destroy_service.rb
app/services/emails/destroy_service.rb
+2
-2
app/services/git_push_service.rb
app/services/git_push_service.rb
+9
-7
app/services/git_tag_push_service.rb
app/services/git_tag_push_service.rb
+7
-1
app/services/groups/destroy_service.rb
app/services/groups/destroy_service.rb
+2
-2
app/services/issuable/clone/base_service.rb
app/services/issuable/clone/base_service.rb
+8
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+2
-2
app/services/issues/build_service.rb
app/services/issues/build_service.rb
+9
-2
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+2
-2
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+2
-2
app/services/notes/quick_actions_service.rb
app/services/notes/quick_actions_service.rb
+9
-3
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+7
-9
app/services/projects/after_rename_service.rb
app/services/projects/after_rename_service.rb
+2
-2
app/services/projects/autocomplete_service.rb
app/services/projects/autocomplete_service.rb
+2
-2
app/services/projects/cleanup_service.rb
app/services/projects/cleanup_service.rb
+1
-1
app/services/projects/create_from_template_service.rb
app/services/projects/create_from_template_service.rb
+2
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+2
-2
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+2
-1
app/services/projects/gitlab_projects_import_service.rb
app/services/projects/gitlab_projects_import_service.rb
+2
-1
app/services/projects/group_links/create_service.rb
app/services/projects/group_links/create_service.rb
+2
-2
app/services/projects/group_links/destroy_service.rb
app/services/projects/group_links/destroy_service.rb
+2
-2
app/services/projects/hashed_storage/migrate_attachments_service.rb
...es/projects/hashed_storage/migrate_attachments_service.rb
+2
-2
app/services/projects/hashed_storage/migrate_repository_service.rb
...ces/projects/hashed_storage/migrate_repository_service.rb
+2
-2
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+2
-2
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+2
-2
app/services/protected_branches/api_service.rb
app/services/protected_branches/api_service.rb
+8
-9
app/services/protected_branches/legacy_api_update_service.rb
app/services/protected_branches/legacy_api_update_service.rb
+13
-31
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+1
-0
app/services/search/group_service.rb
app/services/search/group_service.rb
+2
-10
app/services/search/project_service.rb
app/services/search/project_service.rb
+6
-11
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+0
-1
app/services/users/build_service.rb
app/services/users/build_service.rb
+2
-2
app/services/users/destroy_service.rb
app/services/users/destroy_service.rb
+2
-2
app/services/users/update_service.rb
app/services/users/update_service.rb
+1
-0
ee/app/helpers/ee/mirror_helper.rb
ee/app/helpers/ee/mirror_helper.rb
+40
-0
ee/app/helpers/mirror_helper.rb
ee/app/helpers/mirror_helper.rb
+0
-43
ee/app/services/ee/applications/create_service.rb
ee/app/services/ee/applications/create_service.rb
+5
-3
ee/app/services/ee/base_count_service.rb
ee/app/services/ee/base_count_service.rb
+3
-3
ee/app/services/ee/boards/issues/create_service.rb
ee/app/services/ee/boards/issues/create_service.rb
+11
-10
ee/app/services/ee/boards/lists/list_service.rb
ee/app/services/ee/boards/lists/list_service.rb
+9
-13
ee/app/services/ee/emails/create_service.rb
ee/app/services/ee/emails/create_service.rb
+3
-1
ee/app/services/ee/emails/destroy_service.rb
ee/app/services/ee/emails/destroy_service.rb
+3
-1
ee/app/services/ee/git_push_service.rb
ee/app/services/ee/git_push_service.rb
+25
-0
ee/app/services/ee/git_tag_push_service.rb
ee/app/services/ee/git_tag_push_service.rb
+14
-0
ee/app/services/ee/issuable/clone/base_service.rb
ee/app/services/ee/issuable/clone/base_service.rb
+38
-0
ee/app/services/ee/issuable_base_service.rb
ee/app/services/ee/issuable_base_service.rb
+2
-0
ee/app/services/ee/issues/build_service.rb
ee/app/services/ee/issues/build_service.rb
+5
-2
ee/app/services/ee/issues/move_service.rb
ee/app/services/ee/issues/move_service.rb
+3
-0
ee/app/services/ee/merge_requests/update_service.rb
ee/app/services/ee/merge_requests/update_service.rb
+2
-2
ee/app/services/ee/notes/quick_actions_service.rb
ee/app/services/ee/notes/quick_actions_service.rb
+26
-0
ee/app/services/ee/notification_recipient_builders/default.rb
...pp/services/ee/notification_recipient_builders/default.rb
+10
-0
ee/app/services/ee/projects/destroy_service.rb
ee/app/services/ee/projects/destroy_service.rb
+7
-9
ee/app/services/ee/protected_branches/api_service.rb
ee/app/services/ee/protected_branches/api_service.rb
+16
-0
ee/app/services/ee/protected_branches/legacy_api_update_service.rb
...rvices/ee/protected_branches/legacy_api_update_service.rb
+33
-0
ee/app/services/ee/search/group_service.rb
ee/app/services/ee/search/group_service.rb
+15
-0
ee/app/services/ee/search/project_service.rb
ee/app/services/ee/search/project_service.rb
+21
-0
ee/app/services/ee/system_hooks_service.rb
ee/app/services/ee/system_hooks_service.rb
+12
-4
ee/app/services/ee/users/build_service.rb
ee/app/services/ee/users/build_service.rb
+1
-0
ee/app/services/ee/users/destroy_service.rb
ee/app/services/ee/users/destroy_service.rb
+1
-3
ee/app/services/epics/issue_promote_service.rb
ee/app/services/epics/issue_promote_service.rb
+1
-1
ee/lib/ee/gitlab/ci/status/build/failed.rb
ee/lib/ee/gitlab/ci/status/build/failed.rb
+3
-1
lib/tasks/dev.rake
lib/tasks/dev.rake
+1
-0
No files found.
app/helpers/mirror_helper.rb
View file @
3383cf0a
...
...
@@ -8,3 +8,5 @@ module MirrorHelper
}
end
end
MirrorHelper
.
prepend
(
EE
::
MirrorHelper
)
app/services/applications/create_service.rb
View file @
3383cf0a
...
...
@@ -2,18 +2,18 @@
module
Applications
class
CreateService
prepend
::
EE
::
Applications
::
CreateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
attr_reader
:current_user
,
:params
# rubocop: disable CodeReuse/ActiveRecord
def
initialize
(
current_user
,
params
)
@current_user
=
current_user
@params
=
params
.
except
(
:ip_address
)
@params
=
params
.
except
(
:ip_address
)
# rubocop: disable CodeReuse/ActiveRecord
end
# rubocop: enable CodeReuse/ActiveRecord
# EE would override and use `request` arg
def
execute
(
request
)
Doorkeeper
::
Application
.
create
(
@
params
)
Doorkeeper
::
Application
.
create
(
params
)
end
end
end
Applications
::
CreateService
.
prepend
(
EE
::
Applications
::
CreateService
)
app/services/base_count_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
# Base class for services that count a single resource such as the number of
# issues for a project.
class
BaseCountService
prepend
::
EE
::
BaseCountService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
relation_for_count
raise
(
NotImplementedError
,
...
...
@@ -50,3 +48,5 @@ class BaseCountService
Rails
.
cache
.
write
(
key
,
block_given?
?
yield
:
uncached_count
,
raw:
raw?
)
end
end
BaseCountService
.
prepend
(
EE
::
BaseCountService
)
app/services/boards/issues/create_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
module
Boards
module
Issues
class
CreateService
<
Boards
::
BaseService
prepend
::
EE
::
Boards
::
Issues
::
CreateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
attr_accessor
:project
def
initialize
(
parent
,
project
,
user
,
params
=
{})
...
...
@@ -37,3 +35,5 @@ module Boards
end
end
end
Boards
::
Issues
::
CreateService
.
prepend
(
EE
::
Boards
::
Issues
::
CreateService
)
app/services/boards/lists/list_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
module
Boards
module
Lists
class
ListService
<
Boards
::
BaseService
prepend
::
EE
::
Boards
::
Lists
::
ListService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
board
)
board
.
lists
.
create
(
list_type: :backlog
)
unless
board
.
lists
.
backlog
.
exists?
...
...
@@ -13,3 +11,5 @@ module Boards
end
end
end
Boards
::
Lists
::
ListService
.
prepend
(
EE
::
Boards
::
Lists
::
ListService
)
app/services/emails/base_service.rb
View file @
3383cf0a
...
...
@@ -2,10 +2,11 @@
module
Emails
class
BaseService
attr_reader
:current_user
attr_reader
:current_user
,
:params
,
:user
def
initialize
(
current_user
,
params
=
{})
@current_user
,
@params
=
current_user
,
params
.
dup
@current_user
=
current_user
@params
=
params
.
dup
@user
=
params
.
delete
(
:user
)
end
end
...
...
app/services/emails/create_service.rb
View file @
3383cf0a
...
...
@@ -2,15 +2,14 @@
module
Emails
class
CreateService
<
::
Emails
::
BaseService
prepend
::
EE
::
Emails
::
CreateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
extra_params
=
{})
skip_confirmation
=
@params
.
delete
(
:skip_confirmation
)
email
=
@user
.
emails
.
create
(
@params
.
merge
(
extra_params
))
skip_confirmation
=
params
.
delete
(
:skip_confirmation
)
email
&
.
confirm
if
skip_confirmation
&&
current_user
.
admin?
email
user
.
emails
.
create
(
params
.
merge
(
extra_params
)).
tap
do
|
email
|
email
&
.
confirm
if
skip_confirmation
&&
current_user
.
admin?
end
end
end
end
Emails
::
CreateService
.
prepend
(
EE
::
Emails
::
CreateService
)
app/services/emails/destroy_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Emails
class
DestroyService
<
::
Emails
::
BaseService
prepend
::
EE
::
Emails
::
DestroyService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
email
)
email
.
destroy
&&
update_secondary_emails!
end
...
...
@@ -19,3 +17,5 @@ module Emails
end
end
end
Emails
::
DestroyService
.
prepend
(
EE
::
Emails
::
DestroyService
)
app/services/git_push_service.rb
View file @
3383cf0a
...
...
@@ -55,10 +55,6 @@ class GitPushService < BaseService
update_gitattributes
if
default_branch?
end
if
Gitlab
::
CurrentSettings
.
elasticsearch_indexing?
&&
default_branch?
ElasticCommitIndexerWorker
.
perform_async
(
@project
.
id
,
params
[
:oldrev
],
params
[
:newrev
])
end
execute_related_hooks
perform_housekeeping
...
...
@@ -143,10 +139,8 @@ class GitPushService < BaseService
UpdateMergeRequestsWorker
.
perform_async
(
project
.
id
,
current_user
.
id
,
params
[
:oldrev
],
params
[
:newrev
],
params
[
:ref
])
mirror_update
=
project
.
mirror?
&&
project
.
repository
.
up_to_date_with_upstream?
(
branch_name
)
EventCreateService
.
new
.
push
(
project
,
current_user
,
build_push_data
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
build_push_data
).
execute
(
:push
,
mirror_update:
mirror_update
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
build_push_data
).
execute
(
:push
,
pipeline_options
)
project
.
execute_hooks
(
build_push_data
.
dup
,
:push_hooks
)
project
.
execute_services
(
build_push_data
.
dup
,
:push_hooks
)
...
...
@@ -237,4 +231,12 @@ class GitPushService < BaseService
def
last_pushed_commits
@last_pushed_commits
||=
@push_commits
.
last
(
PROCESS_COMMIT_LIMIT
)
end
private
def
pipeline_options
{}
# to be overriden in EE
end
end
GitPushService
.
prepend
(
EE
::
GitPushService
)
app/services/git_tag_push_service.rb
View file @
3383cf0a
...
...
@@ -10,7 +10,7 @@ class GitTagPushService < BaseService
@push_data
=
build_push_data
EventCreateService
.
new
.
push
(
project
,
current_user
,
push_data
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
push_data
).
execute
(
:push
,
mirror_update:
params
[
:mirror_update
]
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
push_data
).
execute
(
:push
,
pipeline_options
)
SystemHooksService
.
new
.
execute_hooks
(
build_system_push_data
,
:tag_push_hooks
)
project
.
execute_hooks
(
push_data
.
dup
,
:tag_push_hooks
)
...
...
@@ -59,4 +59,10 @@ class GitTagPushService < BaseService
[],
''
)
end
def
pipeline_options
{}
# to be overriden in EE
end
end
GitTagPushService
.
prepend
(
EE
::
GitTagPushService
)
app/services/groups/destroy_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Groups
class
DestroyService
<
Groups
::
BaseService
prepend
::
EE
::
Groups
::
DestroyService
# rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError
=
Class
.
new
(
StandardError
)
def
async_execute
...
...
@@ -36,3 +34,5 @@ module Groups
# rubocop: enable CodeReuse/ActiveRecord
end
end
Groups
::
DestroyService
.
prepend
(
EE
::
Groups
::
DestroyService
)
app/services/issuable/clone/base_service.rb
View file @
3383cf0a
...
...
@@ -51,8 +51,6 @@ module Issuable
end
def
group
return
new_entity
.
group
if
new_entity
.
respond_to?
(
:group
)
&&
new_entity
.
group
if
new_entity
.
project
&
.
group
&&
current_user
.
can?
(
:read_group
,
new_entity
.
project
.
group
)
new_entity
.
project
.
group
end
...
...
@@ -60,3 +58,11 @@ module Issuable
end
end
end
# In the case we are eager-loading, `ee/app/services/ee/issuable/clone/base_service.rb`
# is loaded first, and explicitely requires this file to avoid a
# "TypeError: superclass must be a Class (Module given)" error.
# That also means that we cannot perform the prepending in this file otherwise
# we'd get a circular dependency error, thus we perform the prepending in
# `ee/app/services/ee/issuable/clone/base_service.rb` in that case.
Issuable
::
Clone
::
BaseService
.
prepend
(
EE
::
Issuable
::
Clone
::
BaseService
)
unless
Rails
.
configuration
.
eager_load
app/services/issuable_base_service.rb
View file @
3383cf0a
# frozen_string_literal: true
class
IssuableBaseService
<
BaseService
prepend
::
EE
::
IssuableBaseService
# rubocop: disable Cop/InjectEnterpriseEditionModule
private
attr_accessor
:params
,
:skip_milestone_email
...
...
@@ -390,3 +388,5 @@ class IssuableBaseService < BaseService
project
end
end
IssuableBaseService
.
prepend
(
EE
::
IssuableBaseService
)
app/services/issues/build_service.rb
View file @
3383cf0a
...
...
@@ -3,7 +3,6 @@
module
Issues
class
BuildService
<
Issues
::
BaseService
include
ResolveDiscussions
prepend
::
EE
::
Issues
::
BuildService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
filter_resolve_discussion_params
...
...
@@ -58,9 +57,11 @@ module Issues
end
def
issue_params
@issue_params
||=
issue_params_with_info_from_discussions
.
merge
(
whitelisted_issue_params
)
@issue_params
||=
build_issue_params
end
private
def
whitelisted_issue_params
if
can?
(
current_user
,
:admin_issue
,
project
)
params
.
slice
(
:title
,
:description
,
:milestone_id
)
...
...
@@ -68,5 +69,11 @@ module Issues
params
.
slice
(
:title
,
:description
)
end
end
def
build_issue_params
issue_params_with_info_from_discussions
.
merge
(
whitelisted_issue_params
)
end
end
end
Issues
::
BuildService
.
prepend
(
EE
::
Issues
::
BuildService
)
app/services/issues/move_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Issues
class
MoveService
<
Issuable
::
Clone
::
BaseService
prepend
::
EE
::
Issues
::
MoveService
# rubocop: disable Cop/InjectEnterpriseEditionModule
MoveError
=
Class
.
new
(
StandardError
)
def
execute
(
issue
,
target_project
)
...
...
@@ -66,3 +64,5 @@ module Issues
end
end
end
Issues
::
MoveService
.
prepend
(
EE
::
Issues
::
MoveService
)
app/services/merge_requests/update_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
MergeRequests
class
UpdateService
<
MergeRequests
::
BaseService
prepend
::
EE
::
MergeRequests
::
UpdateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
merge_request
)
# We don't allow change of source/target projects and source branch
# after merge request was created
...
...
@@ -136,3 +134,5 @@ module MergeRequests
end
end
end
MergeRequests
::
UpdateService
.
prepend
(
EE
::
MergeRequests
::
UpdateService
)
app/services/notes/quick_actions_service.rb
View file @
3383cf0a
...
...
@@ -5,12 +5,16 @@ module Notes
UPDATE_SERVICES
=
{
'Issue'
=>
Issues
::
UpdateService
,
'MergeRequest'
=>
MergeRequests
::
UpdateService
,
'Commit'
=>
Commits
::
TagService
,
'Epic'
=>
Epics
::
UpdateService
'Commit'
=>
Commits
::
TagService
}.
freeze
private_constant
:UPDATE_SERVICES
def
self
.
update_services
UPDATE_SERVICES
end
def
self
.
noteable_update_service
(
note
)
UPDATE_SERVICES
[
note
.
noteable_type
]
update_services
[
note
.
noteable_type
]
end
def
self
.
supported?
(
note
)
...
...
@@ -36,3 +40,5 @@ module Notes
end
end
end
Notes
::
QuickActionsService
.
prepend
(
EE
::
Notes
::
QuickActionsService
)
app/services/notification_recipient_service.rb
View file @
3383cf0a
...
...
@@ -242,8 +242,6 @@ module NotificationRecipientService
end
class
Default
<
Base
prepend
::
EE
::
NotificationRecipientBuilders
::
Default
# rubocop: disable Cop/InjectEnterpriseEditionModule
MENTION_TYPE_ACTIONS
=
[
:new_issue
,
:new_merge_request
].
freeze
attr_reader
:target
...
...
@@ -251,6 +249,7 @@ module NotificationRecipientService
attr_reader
:action
attr_reader
:previous_assignee
attr_reader
:skip_current_user
def
initialize
(
target
,
current_user
,
action
:,
custom_action:
nil
,
previous_assignee:
nil
,
skip_current_user:
true
)
@target
=
target
@current_user
=
current_user
...
...
@@ -260,15 +259,13 @@ module NotificationRecipientService
@skip_current_user
=
skip_current_user
end
def
add_watchers
add_project_watchers
end
def
build!
add_participants
(
current_user
)
if
project
add_project_watchers
else
# for group level targets
add_group_watchers
end
add_watchers
add_custom_notifications
# Re-assign is considered as a mention of the new assignee
...
...
@@ -414,4 +411,5 @@ module NotificationRecipientService
end
end
NotificationRecipientService
::
Builder
::
Default
.
prepend
(
EE
::
NotificationRecipientBuilders
::
Default
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
NotificationRecipientService
.
prepend
(
EE
::
NotificationRecipientService
)
app/services/projects/after_rename_service.rb
View file @
3383cf0a
...
...
@@ -12,8 +12,6 @@ module Projects
#
# Projects::AfterRenameService.new(project).execute
class
AfterRenameService
prepend
::
EE
::
Projects
::
AfterRenameService
# rubocop: disable Cop/InjectEnterpriseEditionModule
# @return [String] The Project being renamed.
attr_reader
:project
...
...
@@ -141,3 +139,5 @@ module Projects
end
end
end
Projects
::
AfterRenameService
.
prepend
(
EE
::
Projects
::
AfterRenameService
)
app/services/projects/autocomplete_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Projects
class
AutocompleteService
<
BaseService
prepend
EE
::
Projects
::
AutocompleteService
# rubocop: disable Cop/InjectEnterpriseEditionModule
include
LabelsAsHash
def
issues
IssuesFinder
.
new
(
current_user
,
project_id:
project
.
id
,
state:
'opened'
).
execute
.
select
([
:iid
,
:title
])
...
...
@@ -40,3 +38,5 @@ module Projects
end
end
end
Projects
::
AutocompleteService
.
prepend
(
EE
::
Projects
::
AutocompleteService
)
app/services/projects/cleanup_service.rb
View file @
3383cf0a
...
...
@@ -51,4 +51,4 @@ module Projects
end
end
::
Projects
::
CleanupService
.
prepend
(
::
EE
::
Projects
::
CleanupService
)
Projects
::
CleanupService
.
prepend
(
EE
::
Projects
::
CleanupService
)
app/services/projects/create_from_template_service.rb
View file @
3383cf0a
...
...
@@ -2,7 +2,6 @@
module
Projects
class
CreateFromTemplateService
<
BaseService
prepend
::
EE
::
Projects
::
CreateFromTemplateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
include
Gitlab
::
Utils
::
StrongMemoize
def
initialize
(
user
,
params
)
...
...
@@ -27,3 +26,5 @@ module Projects
end
end
end
Projects
::
CreateFromTemplateService
.
prepend
(
EE
::
Projects
::
CreateFromTemplateService
)
app/services/projects/create_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Projects
class
CreateService
<
BaseService
prepend
::
EE
::
Projects
::
CreateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
initialize
(
user
,
params
)
@current_user
,
@params
=
user
,
params
.
dup
@skip_wiki
=
@params
.
delete
(
:skip_wiki
)
...
...
@@ -198,3 +196,5 @@ module Projects
end
end
end
Projects
::
CreateService
.
prepend
(
EE
::
Projects
::
CreateService
)
app/services/projects/destroy_service.rb
View file @
3383cf0a
...
...
@@ -3,7 +3,6 @@
module
Projects
class
DestroyService
<
BaseService
include
Gitlab
::
ShellAdapter
prepend
::
EE
::
Projects
::
DestroyService
# rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError
=
Class
.
new
(
StandardError
)
...
...
@@ -219,3 +218,5 @@ module Projects
end
end
end
Projects
::
DestroyService
.
prepend
(
EE
::
Projects
::
DestroyService
)
app/services/projects/gitlab_projects_import_service.rb
View file @
3383cf0a
...
...
@@ -5,7 +5,6 @@
# The latter will under the hood just import an archive supplied by GitLab.
module
Projects
class
GitlabProjectsImportService
prepend
::
EE
::
Projects
::
GitlabProjectsImportService
# rubocop: disable Cop/InjectEnterpriseEditionModule
include
Gitlab
::
Utils
::
StrongMemoize
include
Gitlab
::
TemplateHelper
...
...
@@ -70,3 +69,5 @@ module Projects
end
end
end
Projects
::
GitlabProjectsImportService
.
prepend
(
EE
::
Projects
::
GitlabProjectsImportService
)
app/services/projects/group_links/create_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
module
Projects
module
GroupLinks
class
CreateService
<
BaseService
prepend
::
EE
::
Projects
::
GroupLinks
::
CreateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
group
)
return
false
unless
group
...
...
@@ -17,3 +15,5 @@ module Projects
end
end
end
Projects
::
GroupLinks
::
CreateService
.
prepend
(
EE
::
Projects
::
GroupLinks
::
CreateService
)
app/services/projects/group_links/destroy_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
module
Projects
module
GroupLinks
class
DestroyService
<
BaseService
prepend
::
EE
::
Projects
::
GroupLinks
::
DestroyService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
group_link
)
return
false
unless
group_link
...
...
@@ -13,3 +11,5 @@ module Projects
end
end
end
Projects
::
GroupLinks
::
DestroyService
.
prepend
(
EE
::
Projects
::
GroupLinks
::
DestroyService
)
app/services/projects/hashed_storage/migrate_attachments_service.rb
View file @
3383cf0a
...
...
@@ -7,8 +7,6 @@ module Projects
class
MigrateAttachmentsService
<
BaseService
attr_reader
:logger
,
:old_disk_path
,
:new_disk_path
prepend
::
EE
::
Projects
::
HashedStorage
::
MigrateAttachmentsService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
initialize
(
project
,
old_disk_path
,
logger:
nil
)
@project
=
project
@logger
=
logger
||
Rails
.
logger
...
...
@@ -64,3 +62,5 @@ module Projects
end
end
end
Projects
::
HashedStorage
::
MigrateAttachmentsService
.
prepend
(
EE
::
Projects
::
HashedStorage
::
MigrateAttachmentsService
)
app/services/projects/hashed_storage/migrate_repository_service.rb
View file @
3383cf0a
...
...
@@ -3,8 +3,6 @@
module
Projects
module
HashedStorage
class
MigrateRepositoryService
<
BaseRepositoryService
prepend
::
EE
::
Projects
::
HashedStorage
::
MigrateRepositoryService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
try_to_set_repository_read_only!
...
...
@@ -52,3 +50,5 @@ module Projects
end
end
end
Projects
::
HashedStorage
::
MigrateRepositoryService
.
prepend
(
EE
::
Projects
::
HashedStorage
::
MigrateRepositoryService
)
app/services/projects/transfer_service.rb
View file @
3383cf0a
...
...
@@ -13,8 +13,6 @@ module Projects
include
Gitlab
::
ShellAdapter
TransferError
=
Class
.
new
(
StandardError
)
prepend
::
EE
::
Projects
::
TransferService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
new_namespace
)
@new_namespace
=
new_namespace
...
...
@@ -172,3 +170,5 @@ module Projects
end
end
end
Projects
::
TransferService
.
prepend
(
EE
::
Projects
::
TransferService
)
app/services/projects/update_service.rb
View file @
3383cf0a
...
...
@@ -4,8 +4,6 @@ module Projects
class
UpdateService
<
BaseService
include
UpdateVisibilityLevel
prepend
::
EE
::
Projects
::
UpdateService
# rubocop: disable Cop/InjectEnterpriseEditionModule
ValidationError
=
Class
.
new
(
StandardError
)
# rubocop: disable CodeReuse/ActiveRecord
...
...
@@ -135,3 +133,5 @@ module Projects
end
end
end
Projects
::
UpdateService
.
prepend
(
EE
::
Projects
::
UpdateService
)
app/services/protected_branches/api_service.rb
View file @
3383cf0a
...
...
@@ -3,18 +3,17 @@
module
ProtectedBranches
class
ApiService
<
BaseService
def
create
@push_params
=
AccessLevelParams
.
new
(
:push
,
params
)
@merge_params
=
AccessLevelParams
.
new
(
:merge
,
params
)
@unprotect_params
=
AccessLevelParams
.
new
(
:unprotect
,
params
)
::
ProtectedBranches
::
CreateService
.
new
(
@project
,
@current_user
,
protected_branch_params
).
execute
end
protected_branch_params
=
{
def
protected_branch_params
{
name:
params
[
:name
],
push_access_levels_attributes:
@push_params
.
access_levels
,
merge_access_levels_attributes:
@merge_params
.
access_levels
,
unprotect_access_levels_attributes:
@unprotect_params
.
access_levels
push_access_levels_attributes:
AccessLevelParams
.
new
(
:push
,
params
).
access_levels
,
merge_access_levels_attributes:
AccessLevelParams
.
new
(
:merge
,
params
).
access_levels
}
::
ProtectedBranches
::
CreateService
.
new
(
@project
,
@current_user
,
protected_branch_params
).
execute
end
end
end
ProtectedBranches
::
ApiService
.
prepend
(
EE
::
ProtectedBranches
::
ApiService
)
app/services/protected_branches/legacy_api_update_service.rb
View file @
3383cf0a
...
...
@@ -6,30 +6,31 @@
# lives in this service.
module
ProtectedBranches
class
LegacyApiUpdateService
<
BaseService
attr_reader
:protected_branch
,
:developers_can_push
,
:developers_can_merge
def
execute
(
protected_branch
)
@protected_branch
=
protected_branch
@developers_can_push
=
params
.
delete
(
:developers_can_push
)
@developers_can_merge
=
params
.
delete
(
:developers_can_merge
)
@protected_branch
=
protected_branch
protected_branch
.
transaction
do
delete_redundant_
ee_
access_levels
delete_redundant_access_levels
case
@
developers_can_push
case
developers_can_push
when
true
params
[
:push_access_levels_attributes
]
=
[{
access_level:
Gitlab
::
Access
::
DEVELOPER
}]
when
false
params
[
:push_access_levels_attributes
]
=
[{
access_level:
Gitlab
::
Access
::
MAINTAINER
}]
end
case
@
developers_can_merge
case
developers_can_merge
when
true
params
[
:merge_access_levels_attributes
]
=
[{
access_level:
Gitlab
::
Access
::
DEVELOPER
}]
when
false
params
[
:merge_access_levels_attributes
]
=
[{
access_level:
Gitlab
::
Access
::
MAINTAINER
}]
end
service
=
ProtectedBranches
::
UpdateService
.
new
(
@project
,
@current_user
,
@
params
)
service
=
ProtectedBranches
::
UpdateService
.
new
(
project
,
current_user
,
params
)
service
.
execute
(
protected_branch
)
end
end
...
...
@@ -37,34 +38,15 @@ module ProtectedBranches
private
def
delete_redundant_access_levels
unless
@developers_can_merge
.
nil?
@protected_branch
.
merge_access_levels
.
destroy_all
# rubocop: disable DestroyAll # rubocop: disable DestroyAll
end
unless
@developers_can_push
.
nil?
@protected_branch
.
push_access_levels
.
destroy_all
# rubocop: disable DestroyAll # rubocop: disable DestroyAll
unless
developers_can_merge
.
nil?
protected_branch
.
merge_access_levels
.
destroy_all
# rubocop: disable DestroyAll
end
end
# If a protected branch can have more than one access level (EE), only
# remove the relevant access levels. If we don't do this, we'll have a
# failed validation.
def
delete_redundant_ee_access_levels
case
@developers_can_merge
when
true
@protected_branch
.
merge_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
when
false
@protected_branch
.
merge_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
@protected_branch
.
merge_access_levels
.
maintainer
.
destroy_all
# rubocop: disable DestroyAll
end
case
@developers_can_push
when
true
@protected_branch
.
push_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
when
false
@protected_branch
.
push_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
@protected_branch
.
push_access_levels
.
maintainer
.
destroy_all
# rubocop: disable DestroyAll
unless
developers_can_push
.
nil?
protected_branch
.
push_access_levels
.
destroy_all
# rubocop: disable DestroyAll
end
end
end
end
ProtectedBranches
::
LegacyApiUpdateService
.
prepend
(
EE
::
ProtectedBranches
::
LegacyApiUpdateService
)
app/services/quick_actions/interpret_service.rb
View file @
3383cf0a
...
...
@@ -4,6 +4,7 @@ module QuickActions
class
InterpretService
<
BaseService
include
Gitlab
::
Utils
::
StrongMemoize
include
Gitlab
::
QuickActions
::
Dsl
attr_reader
:issuable
SHRUG
=
'¯\\_(ツ)_/¯'
.
freeze
...
...
app/services/search/group_service.rb
View file @
3383cf0a
...
...
@@ -17,15 +17,7 @@ module Search
@projects
=
super
.
inside_path
(
group
.
full_path
)
end
# rubocop: disable CodeReuse/ActiveRecord
def
elastic_projects
@elastic_projects
||=
projects
.
pluck
(
:id
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
elastic_global
false
end
end
end
Search
::
GroupService
.
prepend
(
EE
::
Search
::
GroupService
)
app/services/search/project_service.rb
View file @
3383cf0a
...
...
@@ -9,17 +9,10 @@ module Search
end
def
execute
if
Gitlab
::
CurrentSettings
.
elasticsearch_search?
Gitlab
::
Elastic
::
ProjectSearchResults
.
new
(
current_user
,
params
[
:search
],
project
.
id
,
params
[
:repository_ref
])
else
Gitlab
::
ProjectSearchResults
.
new
(
current_user
,
project
,
params
[
:search
],
params
[
:repository_ref
])
end
Gitlab
::
ProjectSearchResults
.
new
(
current_user
,
project
,
params
[
:search
],
params
[
:repository_ref
])
end
def
scope
...
...
@@ -27,3 +20,5 @@ module Search
end
end
end
Search
::
ProjectService
.
prepend
(
EE
::
Search
::
ProjectService
)
app/services/system_hooks_service.rb
View file @
3383cf0a
...
...
@@ -130,7 +130,6 @@ class SystemHooksService
{
group_name:
model
.
group
.
name
,
group_path:
model
.
group
.
path
,
group_plan:
model
.
group
.
plan
&
.
name
,
group_id:
model
.
group
.
id
,
user_username:
model
.
user
.
username
,
user_name:
model
.
user
.
name
,
...
...
app/services/users/build_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Users
class
BuildService
<
BaseService
prepend
::
EE
::
Users
::
BuildService
# rubocop: disable Cop/InjectEnterpriseEditionModule
delegate
:user_default_internal_regex_enabled?
,
:user_default_internal_regex_instance
,
to: :'Gitlab::CurrentSettings.current_application_settings'
...
...
@@ -123,3 +121,5 @@ module Users
end
end
end
Users
::
BuildService
.
prepend
(
EE
::
Users
::
BuildService
)
app/services/users/destroy_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,6 @@
module
Users
class
DestroyService
prepend
::
EE
::
Users
::
DestroyService
# rubocop: disable Cop/InjectEnterpriseEditionModule
DestroyError
=
Class
.
new
(
StandardError
)
attr_accessor
:current_user
...
...
@@ -66,3 +64,5 @@ module Users
end
end
end
Users
::
DestroyService
.
prepend
(
EE
::
Users
::
DestroyService
)
app/services/users/update_service.rb
View file @
3383cf0a
...
...
@@ -3,6 +3,7 @@
module
Users
class
UpdateService
<
BaseService
include
NewUserNotifier
def
initialize
(
current_user
,
params
=
{})
@current_user
=
current_user
@user
=
params
.
delete
(
:user
)
...
...
ee/app/helpers/ee/mirror_helper.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
MirrorHelper
def
render_mirror_failed_message
(
raw_message
:)
mirror_last_update_at
=
@project
.
import_state
.
last_update_at
message
=
"The repository failed to update
#{
time_ago_with_tooltip
(
mirror_last_update_at
)
}
."
.
html_safe
return
message
if
raw_message
message
.
insert
(
0
,
"
#{
icon
(
'warning triangle'
)
}
"
)
if
can?
(
current_user
,
:admin_project
,
@project
)
link_to
message
,
project_mirror_path
(
@project
)
else
message
end
end
def
branch_diverged_tooltip_message
message
=
[
s_
(
'Branches|The branch could not be updated automatically because it has diverged from its upstream counterpart.'
)]
if
can?
(
current_user
,
:push_code
,
@project
)
message
<<
'<br>'
message
<<
s_
(
"Branches|To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above."
)
end
message
.
join
end
def
options_for_mirror_user
options_from_collection_for_select
(
default_mirror_users
,
:id
,
:name
,
@project
.
mirror_user_id
||
current_user
.
id
)
end
def
mirrored_repositories_count
(
project
=
@project
)
count
=
project
.
mirror
==
true
?
1
:
0
count
+
@project
.
remote_mirrors
.
to_a
.
count
{
|
mirror
|
mirror
.
enabled
}
end
end
end
ee/app/helpers/mirror_helper.rb
deleted
100644 → 0
View file @
410789ad
# frozen_string_literal: true
module
MirrorHelper
def
render_mirror_failed_message
(
raw_message
:)
mirror_last_update_at
=
@project
.
import_state
.
last_update_at
message
=
"The repository failed to update
#{
time_ago_with_tooltip
(
mirror_last_update_at
)
}
."
.
html_safe
return
message
if
raw_message
message
.
insert
(
0
,
"
#{
icon
(
'warning triangle'
)
}
"
)
if
can?
(
current_user
,
:admin_project
,
@project
)
link_to
message
,
project_mirror_path
(
@project
)
else
message
end
end
def
branch_diverged_tooltip_message
message
=
[
s_
(
'Branches|The branch could not be updated automatically because it has diverged from its upstream counterpart.'
)]
if
can?
(
current_user
,
:push_code
,
@project
)
message
<<
'<br>'
message
<<
s_
(
"Branches|To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above."
)
end
message
.
join
end
def
options_for_mirror_user
options_from_collection_for_select
(
default_mirror_users
,
:id
,
:name
,
@project
.
mirror_user_id
||
current_user
.
id
)
end
def
mirrored_repositories_count
(
project
=
@project
)
count
=
project
.
mirror
==
true
?
1
:
0
count
+
@project
.
remote_mirrors
.
to_a
.
count
{
|
mirror
|
mirror
.
enabled
}
end
def
mirrors_form_data_attributes
{
project_mirror_ssh_endpoint:
ssh_host_keys_project_mirror_path
(
@project
,
:json
),
project_mirror_endpoint:
project_mirror_path
(
@project
)
}
end
end
ee/app/services/ee/applications/create_service.rb
View file @
3383cf0a
...
...
@@ -2,8 +2,10 @@
module
EE
module
Applications
# rubocop:disable Gitlab/ModuleWithInstanceVariables
module
CreateService
extend
::
Gitlab
::
Utils
::
Override
override
:execute
def
execute
(
request
)
super
.
tap
do
|
application
|
audit_event_service
(
request
.
remote_ip
).
for_user
(
application
.
name
).
security_event
...
...
@@ -11,8 +13,8 @@ module EE
end
def
audit_event_service
(
ip_address
)
::
AuditEventService
.
new
(
@
current_user
,
@
current_user
,
::
AuditEventService
.
new
(
current_user
,
current_user
,
action: :custom
,
custom_message:
'OAuth access granted'
,
ip_address:
ip_address
)
...
...
ee/app/services/ee/base_count_service.rb
View file @
3383cf0a
...
...
@@ -8,9 +8,9 @@ module EE
# could be incorrect for 2 weeks.
override
:cache_options
def
cache_options
value
=
super
value
[
:expires_in
]
=
20
.
minutes
if
::
Gitlab
::
Geo
.
secondary?
value
super
.
tap
do
|
options
|
options
[
:expires_in
]
=
20
.
minutes
if
::
Gitlab
::
Geo
.
secondary?
end
end
end
end
ee/app/services/ee/boards/issues/create_service.rb
View file @
3383cf0a
...
...
@@ -8,17 +8,18 @@ module EE
override
:issue_params
def
issue_params
assignee_ids
=
Array
(
list
.
user_id
||
board
.
assignee
&
.
id
)
milestone_id
=
list
.
milestone_id
||
board
.
milestone_id
super
.
tap
do
|
options
|
assignee_ids
=
Array
(
list
.
user_id
||
board
.
assignee
&
.
id
)
milestone_id
=
list
.
milestone_id
||
board
.
milestone_id
{
label_ids:
[
list
.
label_id
,
*
board
.
label_ids
],
weight:
board
.
weight
,
milestone_id:
milestone_id
,
# This can be removed when boards have multiple assignee support.
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/3786
assignee_ids:
assignee_ids
}
options
[
:label_ids
].
concat
(
board
.
label_ids
)
options
.
merge!
(
weight:
board
.
weight
,
milestone_id:
milestone_id
,
# This can be removed when boards have multiple assignee support.
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/3786
assignee_ids:
assignee_ids
)
end
end
end
end
...
...
ee/app/services/ee/boards/lists/list_service.rb
View file @
3383cf0a
...
...
@@ -4,36 +4,32 @@ module EE
module
Boards
module
Lists
module
ListService
extend
::
Gitlab
::
Utils
::
Override
# When adding a new licensed type, make sure to also add
# it on license.rb with the pattern "board_<list_type>_lists"
LICENSED_LIST_TYPES
=
[
:assignee
,
:milestone
].
freeze
extend
::
Gitlab
::
Utils
::
Override
LICENSED_LIST_TYPES
=
%i[assignee milestone]
.
freeze
override
:execute
# rubocop: disable CodeReuse/ActiveRecord
def
execute
(
board
)
not_available_lists
=
list_type_features_availability
(
board
)
.
select
{
|
_
,
available
|
!
available
}
not_available_lists
=
list_type_features_availability
(
board
)
.
select
{
|
_
,
available
|
!
available
}
if
not_available_lists
.
any?
super
.
where
.
not
(
list_type:
not_available_lists
.
keys
)
super
.
where
.
not
(
list_type:
not_available_lists
.
keys
)
# rubocop: disable CodeReuse/ActiveRecord
else
super
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
def
list_type_features_availability
(
board
)
parent
=
board
.
parent
{}.
tap
do
|
hash
|
LICENSED_LIST_TYPES
.
each
do
|
list_type
|
list_type_key
=
::
List
.
list_types
[
list_type
]
hash
[
list_type_key
]
=
parent
&
.
feature_available?
(
:"board_
#{
list_type
}
_lists"
)
end
LICENSED_LIST_TYPES
.
each_with_object
({})
do
|
list_type
,
hash
|
list_type_key
=
::
List
.
list_types
[
list_type
]
hash
[
list_type_key
]
=
parent
&
.
feature_available?
(
:"board_
#{
list_type
}
_lists"
)
end
end
end
...
...
ee/app/services/ee/emails/create_service.rb
View file @
3383cf0a
...
...
@@ -3,9 +3,11 @@
module
EE
module
Emails
module
CreateService
extend
::
Gitlab
::
Utils
::
Override
include
::
EE
::
Emails
::
BaseService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
*
args
,
&
blk
)
override
:execute
def
execute
(
extra_params
=
{})
super
.
tap
do
|
email
|
log_audit_event
(
action: :create
)
if
email
.
persisted?
end
...
...
ee/app/services/ee/emails/destroy_service.rb
View file @
3383cf0a
...
...
@@ -3,9 +3,11 @@
module
EE
module
Emails
module
DestroyService
extend
::
Gitlab
::
Utils
::
Override
include
::
EE
::
Emails
::
BaseService
# rubocop: disable Cop/InjectEnterpriseEditionModule
def
execute
(
*
args
,
&
blk
)
override
:execute
def
execute
(
email
)
super
.
tap
do
log_audit_event
(
action: :destroy
)
end
...
...
ee/app/services/ee/git_push_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
GitPushService
extend
::
Gitlab
::
Utils
::
Override
protected
override
:execute_related_hooks
def
execute_related_hooks
if
::
Gitlab
::
CurrentSettings
.
elasticsearch_indexing?
&&
default_branch?
::
ElasticCommitIndexerWorker
.
perform_async
(
project
.
id
,
params
[
:oldrev
],
params
[
:newrev
])
end
super
end
private
override
:pipeline_options
def
pipeline_options
{
mirror_update:
project
.
mirror?
&&
project
.
repository
.
up_to_date_with_upstream?
(
branch_name
)
}
end
end
end
ee/app/services/ee/git_tag_push_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
GitTagPushService
extend
::
Gitlab
::
Utils
::
Override
private
override
:pipeline_options
def
pipeline_options
{
mirror_update:
params
[
:mirror_update
]
}
end
end
end
ee/app/services/ee/issuable/clone/base_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
# When this file is eager-loaded **before `issuable/clone/base_service.rb`**, the
# `Issuable::Clone::BaseService` constant is defined (in this file) as a module,
# making subsequent inheritance from `::Issuable::Clone::BaseService` (e.g. in
# `EE::IssuePromoteService`) failing with a "TypeError: superclass must be a
# Class (Module given)" error.
# Explicitely requiring `issuable/clone/base_service.rb` makes sure that the
# correct `::Issuable::Clone::BaseService` constant is defined first.
require_dependency
'issuable/clone/base_service'
if
Rails
.
configuration
.
eager_load
module
EE
module
Issuable
module
Clone
module
BaseService
extend
::
Gitlab
::
Utils
::
Override
private
override
:group
def
group
if
new_entity
.
respond_to?
(
:group
)
&&
new_entity
.
group
new_entity
.
group
else
super
end
end
end
end
end
end
# When this file is eager-loaded, since we explicitely require
# `issuable/clone/base_service.rb` above, we cannot perform the prepend in
# `issuable/clone/base_service.rb` otherwise we'd get a circular dependency
# error. Thus we perform the prepend in this file, after
# `Issuable::Clone::BaseService` and `EE::Issuable::Clone::BaseService` are defined.
Issuable
::
Clone
::
BaseService
.
prepend
(
EE
::
Issuable
::
Clone
::
BaseService
)
if
Rails
.
configuration
.
eager_load
ee/app/services/ee/issuable_base_service.rb
View file @
3383cf0a
...
...
@@ -2,10 +2,12 @@
module
EE
module
IssuableBaseService
extend
::
Gitlab
::
Utils
::
Override
include
::
Gitlab
::
Utils
::
StrongMemoize
private
override
:filter_params
def
filter_params
(
issuable
)
# This security check is repeated here to avoid multiple backports,
# this should be refactored to be reused from the base class.
...
...
ee/app/services/ee/issues/build_service.rb
View file @
3383cf0a
...
...
@@ -3,6 +3,8 @@
module
EE
module
Issues
module
BuildService
extend
::
Gitlab
::
Utils
::
Override
def
issue_params_from_template
return
{}
unless
project
.
feature_available?
(
:issuable_default_templates
)
...
...
@@ -13,8 +15,9 @@ module EE
# They take precedence over eachother like this
# passed params > discussion params > template params
# The template params are filled in here, and might be overwritten by super
def
issue_params
@issue_params
||=
issue_params_from_template
.
merge
(
super
)
override
:build_issue_params
def
build_issue_params
issue_params_from_template
.
merge
(
super
)
end
end
end
...
...
ee/app/services/ee/issues/move_service.rb
View file @
3383cf0a
...
...
@@ -3,6 +3,9 @@
module
EE
module
Issues
module
MoveService
extend
::
Gitlab
::
Utils
::
Override
override
:update_old_entity
def
update_old_entity
rewrite_epic_issue
super
...
...
ee/app/services/ee/merge_requests/update_service.rb
View file @
3383cf0a
...
...
@@ -35,6 +35,8 @@ module EE
merge_request
end
private
override
:create_branch_change_note
def
create_branch_change_note
(
merge_request
,
branch_type
,
old_branch
,
new_branch
)
super
...
...
@@ -42,8 +44,6 @@ module EE
reset_approvals
(
merge_request
)
end
private
def
reset_approvals
(
merge_request
)
target_project
=
merge_request
.
target_project
...
...
ee/app/services/ee/notes/quick_actions_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
Notes
module
QuickActionsService
extend
ActiveSupport
::
Concern
include
::
Gitlab
::
Utils
::
StrongMemoize
prepended
do
EE_UPDATE_SERVICES
=
const_get
(
:UPDATE_SERVICES
).
merge
(
'Epic'
=>
Epics
::
UpdateService
).
freeze
EE
::
Notes
::
QuickActionsService
.
private_constant
:EE_UPDATE_SERVICES
end
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
override
:update_services
def
update_services
EE_UPDATE_SERVICES
end
end
end
end
end
ee/app/services/ee/notification_recipient_builders/default.rb
View file @
3383cf0a
...
...
@@ -4,6 +4,7 @@ module EE
module
NotificationRecipientBuilders
module
Default
extend
ActiveSupport
::
Concern
extend
::
Gitlab
::
Utils
::
Override
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
...
...
@@ -13,6 +14,15 @@ module EE
super
.
append
(
:new_epic
)
end
end
override
:add_watchers
def
add_watchers
if
project
super
else
# for group level targets
add_group_watchers
end
end
end
end
end
ee/app/services/ee/projects/destroy_service.rb
View file @
3383cf0a
...
...
@@ -7,16 +7,14 @@ module EE
override
:execute
def
execute
su
cceeded
=
super
# It's possible that some error occurred, but at the end of the day
# if the project is destroyed from the database, we should log events
# and clean up where we can.
if
project
&
.
destroyed?
mirror_cleanup
(
project
)
su
per
.
tap
do
# It's possible that some error occurred, but at the end of the day
# if the project is destroyed from the database, we should log events
# and clean up where we can.
if
project
&
.
destroyed?
mirror_cleanup
(
project
)
end
end
succeeded
end
override
:log_destroy_event
...
...
ee/app/services/ee/protected_branches/api_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
ProtectedBranches
module
ApiService
extend
::
Gitlab
::
Utils
::
Override
override
:protected_branch_params
def
protected_branch_params
super
.
tap
do
|
hash
|
hash
[
:unprotect_access_levels_attributes
]
=
::
ProtectedBranches
::
AccessLevelParams
.
new
(
:unprotect
,
params
).
access_levels
end
end
end
end
end
ee/app/services/ee/protected_branches/legacy_api_update_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
ProtectedBranches
module
LegacyApiUpdateService
extend
::
Gitlab
::
Utils
::
Override
private
# If a protected branch can have more than one access level (EE), only
# remove the relevant access levels. If we don't do this, we'll have a
# failed validation.
override
:delete_redundant_access_levels
def
delete_redundant_access_levels
case
developers_can_merge
when
true
protected_branch
.
merge_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
when
false
protected_branch
.
merge_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
protected_branch
.
merge_access_levels
.
maintainer
.
destroy_all
# rubocop: disable DestroyAll
end
case
developers_can_push
when
true
protected_branch
.
push_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
when
false
protected_branch
.
push_access_levels
.
developer
.
destroy_all
# rubocop: disable DestroyAll
protected_branch
.
push_access_levels
.
maintainer
.
destroy_all
# rubocop: disable DestroyAll
end
end
end
end
end
ee/app/services/ee/search/group_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
Search
module
GroupService
def
elastic_projects
@elastic_projects
||=
projects
.
pluck
(
:id
)
# rubocop:disable CodeReuse/ActiveRecord
end
def
elastic_global
false
end
end
end
end
ee/app/services/ee/search/project_service.rb
0 → 100644
View file @
3383cf0a
# frozen_string_literal: true
module
EE
module
Search
module
ProjectService
extend
::
Gitlab
::
Utils
::
Override
override
:execute
def
execute
if
::
Gitlab
::
CurrentSettings
.
elasticsearch_search?
::
Gitlab
::
Elastic
::
ProjectSearchResults
.
new
(
current_user
,
params
[
:search
],
project
.
id
,
params
[
:repository_ref
])
else
super
end
end
end
end
end
ee/app/services/ee/system_hooks_service.rb
View file @
3383cf0a
...
...
@@ -2,14 +2,22 @@
module
EE
module
SystemHooksService
# o
verride
extend
::
Gitlab
::
Utils
::
O
verride
private
override
:group_member_data
def
group_member_data
(
model
)
super
.
tap
do
|
data
|
data
[
:group_plan
]
=
model
.
group
.
plan
&
.
name
end
end
override
:user_data
def
user_data
(
model
)
data
=
super
data
.
merge!
(
email_opted_in_data
(
model
))
if
::
Gitlab
.
com?
data
super
.
tap
do
|
data
|
data
.
merge!
(
email_opted_in_data
(
model
))
if
::
Gitlab
.
com?
end
end
def
email_opted_in_data
(
model
)
...
...
ee/app/services/ee/users/build_service.rb
View file @
3383cf0a
...
...
@@ -16,6 +16,7 @@ module EE
private
override
:signup_params
def
signup_params
super
+
email_opted_in_params
end
...
...
ee/app/services/ee/users/destroy_service.rb
View file @
3383cf0a
...
...
@@ -12,9 +12,8 @@ module EE
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
mirror_cleanup
(
user
)
user_mirrors
=
::
Project
.
where
(
mirror_user:
user
)
user_mirrors
=
::
Project
.
where
(
mirror_user:
user
)
# rubocop: disable CodeReuse/ActiveRecord
user_mirrors
.
find_each
do
|
mirror
|
new_mirror_user
=
first_mirror_owner
(
user
,
mirror
)
...
...
@@ -23,7 +22,6 @@ module EE
::
NotificationService
.
new
.
project_mirror_user_changed
(
new_mirror_user
,
user
.
name
,
mirror
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
...
...
ee/app/services/epics/issue_promote_service.rb
View file @
3383cf0a
# frozen_string_literal: true
module
Epics
class
IssuePromoteService
<
Issuable
::
Clone
::
BaseService
class
IssuePromoteService
<
::
Issuable
::
Clone
::
BaseService
PromoteError
=
Class
.
new
(
StandardError
)
def
execute
(
issue
)
...
...
ee/lib/ee/gitlab/ci/status/build/failed.rb
View file @
3383cf0a
...
...
@@ -15,11 +15,13 @@ module EE
downstream_bridge_project_not_found:
'downstream project could not be found'
,
insufficient_bridge_permissions:
'no permissions to trigger downstream pipeline'
).
freeze
EE
::
Gitlab
::
Ci
::
Status
::
Build
::
Failed
.
private_constant
:EE_REASONS
end
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
override
:reasons
def
reasons
EE_REASONS
end
...
...
lib/tasks/dev.rake
View file @
3383cf0a
...
...
@@ -10,6 +10,7 @@ namespace :dev do
desc
"GitLab | Eager load application"
task
load: :environment
do
Rails
.
configuration
.
eager_load
=
true
Rails
.
application
.
eager_load!
end
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