Ensure legacy Epic views/API return the same dates from the WorkItem view/API
The Problem
Roadmap relies on Epic API and we plan to move it to use Work Item API as a part of #478011, but until we do that, the expectation is that there won't be a significant mismatch of dates between both the APIs especially because other attributes of Epics are consistent between old and new experience.
Proposed Solution
Overwrite Epic dates methods to use the same logic described in &11409 (closed). Since these rules are already coded on WorkItems::Widget::StartAndDueDate, we can use that logic within the epic itself, something like:
class Epic
# ...
def start_date
start_and_due_date_widget.start_date
end
alias_method :start_date_fixed, :start_date
def start_date_is_fixed
start_and_due_date_widget.fixed?
end
alias_method :start_date_is_fixed?, :start_date_is_fixed
def due_date
start_and_due_date_widget.due_date
end
alias_method :end_date, :due_date
alias_method :due_date_fixed, :due_date
def due_date_is_fixed
start_and_due_date_widget.fixed?
end
alias_method :due_date_is_fixed?, :due_date_is_fixed
private
def start_and_due_date_widget
@start_and_due_date_widget ||= work_item.get_widget(:start_and_due_date)
end
# ...
end
Edited by Kassio Borges