Commit 26cefd97 authored by Jan Beckmann's avatar Jan Beckmann Committed by Jarka Košanová

Expose epic inherited start and due date via GraphQL

parent c9eb99bd
...@@ -8279,6 +8279,7 @@ Represents an epic on an issue board. ...@@ -8279,6 +8279,7 @@ Represents an epic on an issue board.
| <a id="boardepicdownvotes"></a>`downvotes` | [`Int!`](#int) | Number of downvotes the epic has received. | | <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="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="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="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="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)) | | <a id="boardepicevents"></a>`events` | [`EventConnection`](#eventconnection) | List of events associated with the object. (see [Connections](#connections)) |
...@@ -8298,6 +8299,7 @@ Represents an epic on an issue board. ...@@ -8298,6 +8299,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="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="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="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="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="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. | | <a id="boardepicstate"></a>`state` | [`EpicState!`](#epicstate) | State of the epic. |
...@@ -9691,6 +9693,7 @@ Represents an epic. ...@@ -9691,6 +9693,7 @@ Represents an epic.
| <a id="epicdownvotes"></a>`downvotes` | [`Int!`](#int) | Number of downvotes the epic has received. | | <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="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="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="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="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)) | | <a id="epicevents"></a>`events` | [`EventConnection`](#eventconnection) | List of events associated with the object. (see [Connections](#connections)) |
...@@ -9710,6 +9713,7 @@ Represents an epic. ...@@ -9710,6 +9713,7 @@ Represents an epic.
| <a id="epicrelativeposition"></a>`relativePosition` | [`Int`](#int) | Relative position of the epic in the epic tree. | | <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="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="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="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="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. | | <a id="epicstate"></a>`state` | [`EpicState!`](#epicstate) | State of the epic. |
......
...@@ -96,7 +96,11 @@ module Resolvers ...@@ -96,7 +96,11 @@ module Resolvers
{ {
parent: [:parent], parent: [:parent],
events: { events: [:target] }, 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 end
......
...@@ -50,6 +50,9 @@ module Types ...@@ -50,6 +50,9 @@ module Types
field :start_date_from_milestones, Types::TimeType, null: true, field :start_date_from_milestones, Types::TimeType, null: true,
description: 'Inherited start date of the epic from milestones.', description: 'Inherited start date of the epic from milestones.',
authorize: :admin_epic 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, field :due_date, Types::TimeType, null: true,
description: 'Due date of the epic.' description: 'Due date of the epic.'
...@@ -62,6 +65,9 @@ module Types ...@@ -62,6 +65,9 @@ module Types
field :due_date_from_milestones, Types::TimeType, null: true, field :due_date_from_milestones, Types::TimeType, null: true,
description: 'Inherited due date of the epic from milestones.', description: 'Inherited due date of the epic from milestones.',
authorize: :admin_epic 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, field :upvotes, GraphQL::Types::Int, null: false,
description: 'Number of upvotes the epic has received.' description: 'Number of upvotes the epic has received.'
......
...@@ -193,14 +193,10 @@ module EE ...@@ -193,14 +193,10 @@ module EE
def set_fixed_start_date def set_fixed_start_date
self.start_date = start_date_fixed self.start_date = start_date_fixed
self.start_date_sourcing_milestone = nil
self.due_date_sourcing_epic = nil
end end
def set_fixed_due_date def set_fixed_due_date
self.end_date = due_date_fixed self.end_date = due_date_fixed
self.due_date_sourcing_milestone = nil
self.due_date_sourcing_epic = nil
end end
def usage_ping_record_epic_creation def usage_ping_record_epic_creation
......
...@@ -7,9 +7,10 @@ RSpec.describe GitlabSchema.types['Epic'] do ...@@ -7,9 +7,10 @@ RSpec.describe GitlabSchema.types['Epic'] do
%i[ %i[
id iid title titleHtml description descriptionHtml confidential state group id iid title titleHtml description descriptionHtml confidential state group
parent author labels start_date start_date_is_fixed start_date_fixed 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 start_date_from_milestones start_date_from_inherited_source due_date
due_date_from_milestones closed_at created_at updated_at children has_children due_date_is_fixed due_date_fixed due_date_from_milestones due_date_from_inherited_source
has_issues has_parent web_path web_url relation_path reference issues user_permissions 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 notes discussions relative_position subscribed participants
descendant_counts descendant_weight_sum upvotes downvotes descendant_counts descendant_weight_sum upvotes downvotes
user_notes_count user_discussions_count health_status current_user_todos user_notes_count user_discussions_count health_status current_user_todos
......
...@@ -467,6 +467,20 @@ RSpec.describe Epic do ...@@ -467,6 +467,20 @@ RSpec.describe Epic do
expect(subject.start_date_from_milestones).to eq(milestone.start_date) expect(subject.start_date_from_milestones).to eq(milestone.start_date)
end 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 end
context 'milestone date' do context 'milestone date' do
...@@ -487,6 +501,20 @@ RSpec.describe Epic do ...@@ -487,6 +501,20 @@ RSpec.describe Epic do
expect(subject.due_date_from_milestones).to eq(milestone.due_date) expect(subject.due_date_from_milestones).to eq(milestone.due_date)
end 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 end
context 'milestone date' do 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