Commit 6f1b8a86 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch '327808-duedateinheritedsource' into 'master'

Expose epic inherited start and due date via GraphQL

See merge request gitlab-org/gitlab!72726
parents 4d7f479a 26cefd97
......@@ -8339,6 +8339,7 @@ Represents an epic on an issue board.
| <a id="boardepicdownvotes"></a>`downvotes` | [`Int!`](#int) | Number of downvotes the epic has received. |
| <a id="boardepicduedate"></a>`dueDate` | [`Time`](#time) | Due date of the epic. |
| <a id="boardepicduedatefixed"></a>`dueDateFixed` | [`Time`](#time) | Fixed due date of the epic. |
| <a id="boardepicduedatefrominheritedsource"></a>`dueDateFromInheritedSource` | [`Time`](#time) | Inherited due date of the epic from child epics or milestones. |
| <a id="boardepicduedatefrommilestones"></a>`dueDateFromMilestones` | [`Time`](#time) | Inherited due date of the epic from milestones. |
| <a id="boardepicduedateisfixed"></a>`dueDateIsFixed` | [`Boolean`](#boolean) | Indicates if the due date has been manually set. |
| <a id="boardepicevents"></a>`events` | [`EventConnection`](#eventconnection) | List of events associated with the object. (see [Connections](#connections)) |
......@@ -8358,6 +8359,7 @@ Represents an epic on an issue board.
| <a id="boardepicrelativeposition"></a>`relativePosition` | [`Int`](#int) | Relative position of the epic in the epic tree. |
| <a id="boardepicstartdate"></a>`startDate` | [`Time`](#time) | Start date of the epic. |
| <a id="boardepicstartdatefixed"></a>`startDateFixed` | [`Time`](#time) | Fixed start date of the epic. |
| <a id="boardepicstartdatefrominheritedsource"></a>`startDateFromInheritedSource` | [`Time`](#time) | Inherited start date of the epic from child epics or milestones. |
| <a id="boardepicstartdatefrommilestones"></a>`startDateFromMilestones` | [`Time`](#time) | Inherited start date of the epic from milestones. |
| <a id="boardepicstartdateisfixed"></a>`startDateIsFixed` | [`Boolean`](#boolean) | Indicates if the start date has been manually set. |
| <a id="boardepicstate"></a>`state` | [`EpicState!`](#epicstate) | State of the epic. |
......@@ -9765,6 +9767,7 @@ Represents an epic.
| <a id="epicdownvotes"></a>`downvotes` | [`Int!`](#int) | Number of downvotes the epic has received. |
| <a id="epicduedate"></a>`dueDate` | [`Time`](#time) | Due date of the epic. |
| <a id="epicduedatefixed"></a>`dueDateFixed` | [`Time`](#time) | Fixed due date of the epic. |
| <a id="epicduedatefrominheritedsource"></a>`dueDateFromInheritedSource` | [`Time`](#time) | Inherited due date of the epic from child epics or milestones. |
| <a id="epicduedatefrommilestones"></a>`dueDateFromMilestones` | [`Time`](#time) | Inherited due date of the epic from milestones. |
| <a id="epicduedateisfixed"></a>`dueDateIsFixed` | [`Boolean`](#boolean) | Indicates if the due date has been manually set. |
| <a id="epicevents"></a>`events` | [`EventConnection`](#eventconnection) | List of events associated with the object. (see [Connections](#connections)) |
......@@ -9784,6 +9787,7 @@ Represents an epic.
| <a id="epicrelativeposition"></a>`relativePosition` | [`Int`](#int) | Relative position of the epic in the epic tree. |
| <a id="epicstartdate"></a>`startDate` | [`Time`](#time) | Start date of the epic. |
| <a id="epicstartdatefixed"></a>`startDateFixed` | [`Time`](#time) | Fixed start date of the epic. |
| <a id="epicstartdatefrominheritedsource"></a>`startDateFromInheritedSource` | [`Time`](#time) | Inherited start date of the epic from child epics or milestones. |
| <a id="epicstartdatefrommilestones"></a>`startDateFromMilestones` | [`Time`](#time) | Inherited start date of the epic from milestones. |
| <a id="epicstartdateisfixed"></a>`startDateIsFixed` | [`Boolean`](#boolean) | Indicates if the start date has been manually set. |
| <a id="epicstate"></a>`state` | [`EpicState!`](#epicstate) | State of the epic. |
......@@ -96,7 +96,11 @@ module Resolvers
{
parent: [:parent],
events: { events: [:target] },
award_emoji: [:award_emoji]
award_emoji: [:award_emoji],
start_date_from_milestones: [:start_date_sourcing_milestone],
start_date_from_inherited_source: [:start_date_sourcing_milestone, :start_date_sourcing_epic],
due_date_from_milestones: [:due_date_sourcing_milestone],
due_date_from_inherited_source: [:due_date_sourcing_milestone, :due_date_sourcing_epic]
}
end
......
......@@ -50,6 +50,9 @@ module Types
field :start_date_from_milestones, Types::TimeType, null: true,
description: 'Inherited start date of the epic from milestones.',
authorize: :admin_epic
field :start_date_from_inherited_source, Types::TimeType, null: true,
description: 'Inherited start date of the epic from child epics or milestones.',
authorize: :admin_epic
field :due_date, Types::TimeType, null: true,
description: 'Due date of the epic.'
......@@ -62,6 +65,9 @@ module Types
field :due_date_from_milestones, Types::TimeType, null: true,
description: 'Inherited due date of the epic from milestones.',
authorize: :admin_epic
field :due_date_from_inherited_source, Types::TimeType, null: true,
description: 'Inherited due date of the epic from child epics or milestones.',
authorize: :admin_epic
field :upvotes, GraphQL::Types::Int, null: false,
description: 'Number of upvotes the epic has received.'
......
......@@ -193,14 +193,10 @@ module EE
def set_fixed_start_date
self.start_date = start_date_fixed
self.start_date_sourcing_milestone = nil
self.due_date_sourcing_epic = nil
end
def set_fixed_due_date
self.end_date = due_date_fixed
self.due_date_sourcing_milestone = nil
self.due_date_sourcing_epic = nil
end
def usage_ping_record_epic_creation
......
......@@ -7,9 +7,10 @@ RSpec.describe GitlabSchema.types['Epic'] do
%i[
id iid title titleHtml description descriptionHtml confidential state group
parent author labels start_date start_date_is_fixed start_date_fixed
start_date_from_milestones due_date due_date_is_fixed due_date_fixed
due_date_from_milestones closed_at created_at updated_at children has_children
has_issues has_parent web_path web_url relation_path reference issues user_permissions
start_date_from_milestones start_date_from_inherited_source due_date
due_date_is_fixed due_date_fixed due_date_from_milestones due_date_from_inherited_source
closed_at created_at updated_at children has_children has_issues
has_parent web_path web_url relation_path reference issues user_permissions
notes discussions relative_position subscribed participants
descendant_counts descendant_weight_sum upvotes downvotes
user_notes_count user_discussions_count health_status current_user_todos
......
......@@ -467,6 +467,20 @@ RSpec.describe Epic do
expect(subject.start_date_from_milestones).to eq(milestone.start_date)
end
it 'keeps start date sourcing milestone when switching to fixed dates' do
source_milestone = create(:milestone, :with_dates)
epic = create(:epic, start_date_sourcing_milestone: source_milestone, start_date_is_fixed: false)
expect { epic.update!(start_date_is_fixed: true) }.not_to change { epic.start_date_sourcing_milestone }
end
it 'keeps start date sourcing epic when switching to fixed dates' do
source_epic = create(:epic, start_date: Time.current)
epic = create(:epic, start_date_sourcing_epic: source_epic, start_date_is_fixed: false)
expect { epic.update!(start_date_is_fixed: true) }.not_to change { epic.start_date_sourcing_epic }
end
end
context 'milestone date' do
......@@ -487,6 +501,20 @@ RSpec.describe Epic do
expect(subject.due_date_from_milestones).to eq(milestone.due_date)
end
it 'keeps due date sourcing milestone when switching to fixed dates' do
source_milestone = create(:milestone, :with_dates)
epic = create(:epic, due_date_sourcing_milestone: source_milestone, due_date_is_fixed: false)
expect { epic.update!(due_date_is_fixed: true) }.not_to change { epic.due_date_sourcing_milestone }
end
it 'keeps due date sourcing epic when switching to fixed dates' do
source_epic = create(:epic, due_date: Time.current)
epic = create(:epic, due_date_sourcing_epic: source_epic, due_date_is_fixed: false)
expect { epic.update!(due_date_is_fixed: true) }.not_to change { epic.due_date_sourcing_epic }
end
end
context 'milestone date' do
......
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