diff options
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/build_service.rb | 10 | ||||
-rw-r--r-- | app/services/issues/related_branches_service.rb | 20 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 4 |
3 files changed, 30 insertions, 4 deletions
diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb index daef468987e..e62315de5f9 100644 --- a/app/services/issues/build_service.rb +++ b/app/services/issues/build_service.rb @@ -65,15 +65,19 @@ module Issues private def whitelisted_issue_params + base_params = [:title, :description, :confidential] + admin_params = [:milestone_id] + if can?(current_user, :admin_issue, project) - params.slice(:title, :description, :milestone_id) + params.slice(*(base_params + admin_params)) else - params.slice(:title, :description) + params.slice(*base_params) end end def build_issue_params - issue_params_with_info_from_discussions.merge(whitelisted_issue_params) + { author: current_user }.merge(issue_params_with_info_from_discussions) + .merge(whitelisted_issue_params) end end end diff --git a/app/services/issues/related_branches_service.rb b/app/services/issues/related_branches_service.rb index 76af482b7ac..46076218857 100644 --- a/app/services/issues/related_branches_service.rb +++ b/app/services/issues/related_branches_service.rb @@ -5,11 +5,29 @@ module Issues class RelatedBranchesService < Issues::BaseService def execute(issue) - branches_with_iid_of(issue) - branches_with_merge_request_for(issue) + branch_names = branches_with_iid_of(issue) - branches_with_merge_request_for(issue) + branch_names.map { |branch_name| branch_data(branch_name) } end private + def branch_data(branch_name) + { + name: branch_name, + pipeline_status: pipeline_status(branch_name) + } + end + + def pipeline_status(branch_name) + branch = project.repository.find_branch(branch_name) + target = branch&.dereferenced_target + + return unless target + + pipeline = project.pipeline_for(branch_name, target.sha) + pipeline.detailed_status(current_user) if can?(current_user, :read_pipeline, pipeline) + end + def branches_with_merge_request_for(issue) Issues::ReferencedMergeRequestsService .new(project, current_user) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 78ebbd7bff2..ee1a22634af 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -21,6 +21,10 @@ module Issues spam_check(issue, current_user) unless skip_spam_check end + def after_update(issue) + IssuesChannel.broadcast_to(issue, event: 'updated') if Feature.enabled?(:broadcast_issue_updates, issue.project) + end + def handle_changes(issue, options) old_associations = options.fetch(:old_associations, {}) old_labels = old_associations.fetch(:labels, []) |