diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-31 09:10:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-31 09:10:40 +0300 |
commit | d6ae5ba9dfaf8a39bf570a72e2152fc23501ed34 (patch) | |
tree | 075e9b263f0d12396729efdf41a1c1a06dfc6f8b /app | |
parent | 5fa401a99e6da5a7575561359f06886b5d078ec9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/projects/issues_controller.rb | 2 | ||||
-rw-r--r-- | app/models/hooks/web_hook.rb | 2 | ||||
-rw-r--r-- | app/serializers/fork_namespace_entity.rb | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index 8fa3635a737..9e42d218ceb 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -56,7 +56,13 @@ class Projects::ForksController < Projects::ApplicationController can_fork_to?(current_user.namespace) render json: { - namespaces: ForkNamespaceSerializer.new.represent(namespaces, project: project, current_user: current_user, memberships: memberships_hash) + namespaces: ForkNamespaceSerializer.new.represent( + namespaces, + project: project, + current_user: current_user, + memberships: memberships_hash, + forked_projects: forked_projects_by_namespace(namespaces) + ) } end end @@ -129,6 +135,10 @@ class Projects::ForksController < Projects::ApplicationController def memberships_hash current_user.members.where(source: load_namespaces_with_associations).index_by(&:source_id) end + + def forked_projects_by_namespace(namespaces) + project.forks.where(namespace: namespaces).includes(:namespace).index_by(&:namespace_id) + end end Projects::ForksController.prepend_mod_with('Projects::ForksController') diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 01a6de76ba5..9741e9e4b20 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -160,7 +160,7 @@ class Projects::IssuesController < Projects::ApplicationController new_project = Project.find(params[:move_to_project_id]) return render_404 unless issue.can_move?(current_user, new_project) - @issue = ::Issues::UpdateService.new(project: project, current_user: current_user, params: { target_project: new_project }).execute(issue) + @issue = ::Issues::MoveService.new(project: project, current_user: current_user).execute(issue, new_project) end respond_to do |format| diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb index 1f0e9fbc287..5f8fa4bca0a 100644 --- a/app/models/hooks/web_hook.rb +++ b/app/models/hooks/web_hook.rb @@ -73,6 +73,8 @@ class WebHook < ApplicationRecord end def enable! + return if recent_failures == 0 && disabled_until.nil? && backoff_count == 0 + update!(recent_failures: 0, disabled_until: nil, backoff_count: 0) end diff --git a/app/serializers/fork_namespace_entity.rb b/app/serializers/fork_namespace_entity.rb index fbcdf91a1af..5fb083e29b0 100644 --- a/app/serializers/fork_namespace_entity.rb +++ b/app/serializers/fork_namespace_entity.rb @@ -13,7 +13,7 @@ class ForkNamespaceEntity < Grape::Entity end expose :forked_project_path do |namespace, options| - if forked_project = namespace.find_fork_of(options[:project]) + if forked_project = options.dig(:forked_projects, namespace.id) project_path(forked_project) end end |