Module: ApprovableBase

Extended by:
ActiveSupport::Concern
Included in:
MergeRequest
Defined in:
app/models/concerns/approvable_base.rb

Instance Method Summary collapse

Instance Method Details

#approved_by?(user) ⇒ Boolean

Returns:

  • (Boolean)

11
12
13
14
15
# File 'app/models/concerns/approvable_base.rb', line 11

def approved_by?(user)
  return false unless user

  approved_by_users.include?(user)
end

#can_be_approved_by?(user) ⇒ Boolean

Returns:

  • (Boolean)

17
18
19
# File 'app/models/concerns/approvable_base.rb', line 17

def can_be_approved_by?(user)
  user && !approved_by?(user) && user.can?(:approve_merge_request, self)
end