Commit 255071ac authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'ee-issue-10671' into 'master'

Extract EE specific lines from issue.rb

Closes #10671

See merge request gitlab-org/gitlab-ee!10700
parents a5065642 1b63de97
...@@ -128,12 +128,6 @@ module Issuable ...@@ -128,12 +128,6 @@ module Issuable
assignees.count > 1 assignees.count > 1
end end
def milestone_available?
return true if is_a?(Epic)
project_id == milestone&.project_id || project.ancestors_upto.compact.include?(milestone&.group)
end
private private
def milestone_is_valid def milestone_is_valid
...@@ -279,6 +273,10 @@ module Issuable ...@@ -279,6 +273,10 @@ module Issuable
end end
end end
def milestone_available?
project_id == milestone&.project_id || project.ancestors_upto.compact.include?(milestone&.group)
end
def assignee_or_author?(user) def assignee_or_author?(user)
author_id == user.id || assignees.exists?(user.id) author_id == user.id || assignees.exists?(user.id)
end end
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module EE module EE
module Issuable module Issuable
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
class_methods do class_methods do
def labels_hash def labels_hash
...@@ -17,6 +18,13 @@ module EE ...@@ -17,6 +18,13 @@ module EE
end end
end end
override :milestone_available?
def milestone_available?
return true if is_a?(Epic)
super
end
def supports_epic? def supports_epic?
is_a?(Issue) && project.group is_a?(Issue) && project.group
end end
......
...@@ -19,4 +19,22 @@ describe EE::Issuable do ...@@ -19,4 +19,22 @@ describe EE::Issuable do
expect(relation.labels_hash[issue_id]).to include('Feature', 'Second Label') expect(relation.labels_hash[issue_id]).to include('Feature', 'Second Label')
end end
end end
describe '#milestone_available?' do
context 'with Epic' do
let(:epic) { create(:epic) }
it 'returns true' do
expect(epic.milestone_available?).to be_truthy
end
end
context 'no Epic' do
let(:issue) { create(:issue) }
it 'returns false' do
expect(issue.milestone_available?).to be_falsy
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment