Class: MergeRequests::Conflicts::ListService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/merge_requests/conflicts/list_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#merge_request

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from MergeRequests::Conflicts::BaseService

Instance Method Details

#can_be_resolved_by?(user) ⇒ Boolean

Returns:

  • (Boolean)

8
9
10
11
12
13
# File 'app/services/merge_requests/conflicts/list_service.rb', line 8

def can_be_resolved_by?(user)
  return false unless merge_request.source_project

  access = ::Gitlab::UserAccess.new(user, container: merge_request.source_project)
  access.can_push_to_branch?(merge_request.source_branch)
end

#can_be_resolved_in_ui?Boolean

Returns:

  • (Boolean)

15
16
17
18
19
20
21
22
23
# File 'app/services/merge_requests/conflicts/list_service.rb', line 15

def can_be_resolved_in_ui?
  return @conflicts_can_be_resolved_in_ui if defined?(@conflicts_can_be_resolved_in_ui)

  return @conflicts_can_be_resolved_in_ui = false unless merge_request.cannot_be_merged?
  return @conflicts_can_be_resolved_in_ui = false unless merge_request.has_complete_diff_refs?
  return @conflicts_can_be_resolved_in_ui = false if merge_request.branch_missing?

  @conflicts_can_be_resolved_in_ui = conflicts.can_be_resolved_in_ui?
end

#conflictsObject


25
26
27
# File 'app/services/merge_requests/conflicts/list_service.rb', line 25

def conflicts
  @conflicts ||= Gitlab::Conflict::FileCollection.new(merge_request)
end