Skip to content
代码片段 群组 项目
未验证 提交 a1ea0e7f 编辑于 作者: Kassio Borges's avatar Kassio Borges 提交者: GitLab
浏览文件

Merge branch '474034-skip-due-date-validation-on-work-item-epics' into 'master'

Skip issue due date validation on work item epics

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/160442



Merged-by: default avatarKassio Borges <kborges@gitlab.com>
Approved-by: default avatarAlexandru Croitor <acroitor@gitlab.com>
Approved-by: default avatarKassio Borges <kborges@gitlab.com>
Co-authored-by: default avatarEugenia Grieff <egrieff@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -117,7 +117,7 @@ def most_recent
validates :confidential, inclusion: { in: [true, false], message: 'must be a boolean' }
validate :allowed_work_item_type_change, on: :update, if: :work_item_type_id_changed?
validate :due_date_after_start_date
validate :due_date_after_start_date, if: :validate_due_date?
validate :parent_link_confidentiality
alias_attribute :external_author, :service_desk_reply_to
......@@ -891,6 +891,10 @@ def linked_issues_select
'issue_links.created_at as issue_link_created_at',
'issue_links.updated_at as issue_link_updated_at'])
end
def validate_due_date?
true
end
end
Issue.prepend_mod_with('Issue')
......@@ -135,5 +135,12 @@ def allowed_work_item_type_change
def previous_type_was_epic?
changes["work_item_type_id"].first == ::WorkItems::Type.default_by_type(:epic).id
end
override :validate_due_date?
def validate_due_date?
return false if epic_work_item?
super
end
end
end
......@@ -21,6 +21,28 @@
.inverse_of(:work_item)
end
describe 'custom validations' do
subject(:valid?) { work_item.valid? }
describe 'due_date_after_start_date' do
context 'when type is epic' do
context 'when both values are not present' do
let(:work_item) { build(:work_item, :epic, namespace: reusable_group) }
it { is_expected.to be_truthy }
end
context 'when due date is before start date' do
let(:work_item) do
build(:work_item, :epic, namespace: reusable_group, due_date: 1.week.ago, start_date: 1.week.from_now)
end
it { is_expected.to be_truthy }
end
end
end
end
describe '#supported_quick_action_commands' do
subject { work_item.supported_quick_action_commands }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册