summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorZJ van de Weg <zegerjan@gitlab.com>2016-05-30 14:46:23 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-05-30 18:54:08 +0200
commitcbd7801b3d1d435a95ec70032c5acc9df33b0337 (patch)
tree7bd367bf31690e4a6b0115d238cf2c312c9fb2ab /app/services
parentf99b38c9d5dab11677b2680a671c1a66fb69283b (diff)
parent2485bd7bbf9686f993d2a417943feff5c7d5b6f3 (diff)
downloadgitlab-ce-cbd7801b3d1d435a95ec70032c5acc9df33b0337.tar.gz
Merge branch 'master' into awardables
Diffstat (limited to 'app/services')
-rw-r--r--app/services/git_push_service.rb17
-rw-r--r--app/services/notes/create_service.rb11
-rw-r--r--app/services/projects/fork_service.rb14
3 files changed, 13 insertions, 29 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 66136b62617..a886f35981f 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -53,10 +53,6 @@ class GitPushService < BaseService
# could cause the last commit of a merge request to change.
update_merge_requests
- # Checks if the main language has changed in the project and if so
- # it updates it accordingly
- update_main_language
-
perform_housekeeping
end
@@ -64,19 +60,6 @@ class GitPushService < BaseService
@project.repository.copy_gitattributes(params[:ref])
end
- def update_main_language
- # Performance can be bad so for now only check main_language once
- # See https://gitlab.com/gitlab-org/gitlab-ce/issues/14937
- return if @project.main_language.present?
-
- return unless is_default_branch?
- return unless push_to_new_branch? || push_to_existing_branch?
-
- current_language = @project.repository.main_language
- @project.update_attributes(main_language: current_language)
- true
- end
-
protected
def update_merge_requests
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index 44ff96f9bd8..02fca5c0ea3 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -12,8 +12,6 @@ module Notes
return noteable.create_award_emoji(note.award_emoji_name, current_user)
end
- return unless valid_project?(note)
-
if note.save
# Finish the harder work in the background
NewNoteWorker.perform_in(2.seconds, note.id, params)
@@ -22,14 +20,5 @@ module Notes
note
end
-
- private
-
- def valid_project?(note)
- return false unless project
- return true if note.for_commit?
-
- note.noteable.try(:project) == project
- end
end
end
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb
index 0577ae778d5..de6dc38cc8e 100644
--- a/app/services/projects/fork_service.rb
+++ b/app/services/projects/fork_service.rb
@@ -3,7 +3,7 @@ module Projects
def execute
new_params = {
forked_from_project_id: @project.id,
- visibility_level: @project.visibility_level,
+ visibility_level: allowed_visibility_level,
description: @project.description,
name: @project.name,
path: @project.path,
@@ -19,5 +19,17 @@ module Projects
new_project = CreateService.new(current_user, new_params).execute
new_project
end
+
+ private
+
+ def allowed_visibility_level
+ project_level = @project.visibility_level
+
+ if Gitlab::VisibilityLevel.non_restricted_level?(project_level)
+ project_level
+ else
+ Gitlab::VisibilityLevel.highest_allowed_level
+ end
+ end
end
end