Commit a34f95db authored by David O'Regan's avatar David O'Regan Committed by Olena Horal-Koretska

Remove time tracking from incidents

We remove the time tracking feature
from incidents but leave it as part
of the issue sidebar.
parent f2202de3
......@@ -181,6 +181,14 @@ module Issuable
false
end
def supports_time_tracking?
is_a?(TimeTrackable) && !incident?
end
def incident?
is_a?(Issue) && super
end
private
def description_max_length_for_new_records_is_valid
......
......@@ -103,6 +103,8 @@ class IssuableSidebarBasicEntity < Grape::Entity
issuable.project.emails_disabled?
end
expose :supports_time_tracking?, as: :supports_time_tracking
private
def current_user
......
......@@ -55,12 +55,13 @@
= dropdown_tag('Milestone', options: { title: _('Assign milestone'), toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: _('Search milestones'), data: { show_no: true, field_name: "#{issuable_type}[milestone_id]", project_id: issuable_sidebar[:project_id], issuable_id: issuable_sidebar[:id], milestones: issuable_sidebar[:project_milestones_path], ability_name: issuable_type, issue_update: issuable_sidebar[:issuable_json_path], use_id: true, default_no: true, selected: milestone[:title], null_default: true, display: 'static' }})
- if @project.group.present?
= render_if_exists 'shared/issuable/iteration_select', { can_edit: can_edit_issuable, group_path: @project.group.full_path, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid], issuable_type: issuable_type }
#issuable-time-tracker.block
// Fallback while content is loading
.title.hide-collapsed
= _('Time tracking')
= icon('spinner spin', 'aria-hidden': 'true')
- if issuable_sidebar[:supports_time_tracking]
#issuable-time-tracker.block
// Fallback while content is loading
.title.hide-collapsed
= _('Time tracking')
= icon('spinner spin', 'aria-hidden': 'true')
- if issuable_sidebar.has_key?(:due_date)
.block.due_date
.sidebar-collapsed-icon.has-tooltip{ data: { placement: 'left', container: 'body', html: 'true', boundary: 'viewport' }, title: sidebar_due_date_tooltip_label(issuable_sidebar[:due_date]) }
......
---
title: Remove time tracking from incidents sidebar
merge_request: 39837
author:
type: changed
......@@ -42,6 +42,7 @@
"project_labels_path": { "type": "string" },
"toggle_subscription_path": { "type": "string" },
"move_issue_path": { "type": "string" },
"projects_autocomplete_path": { "type": "string" }
"projects_autocomplete_path": { "type": "string" },
"supports_time_tracking": { "type": "boolean" }
}
}
......@@ -51,6 +51,7 @@
"project_labels_path": { "type": "string" },
"toggle_subscription_path": { "type": "string" },
"move_issue_path": { "type": "string" },
"projects_autocomplete_path": { "type": "string" }
"projects_autocomplete_path": { "type": "string" },
"supports_time_tracking": { "type": "boolean" }
}
}
......@@ -824,4 +824,40 @@ RSpec.describe Issuable do
it_behaves_like 'matches_cross_reference_regex? fails fast'
end
end
describe '#supports_time_tracking?' do
using RSpec::Parameterized::TableSyntax
where(:issuable_type, :supports_time_tracking) do
:issue | true
:incident | false
:merge_request | true
end
with_them do
let(:issuable) { build_stubbed(issuable_type) }
subject { issuable.supports_time_tracking? }
it { is_expected.to eq(supports_time_tracking) }
end
end
describe '#incident?' do
using RSpec::Parameterized::TableSyntax
where(:issuable_type, :incident) do
:issue | false
:incident | true
:merge_request | false
end
with_them do
let(:issuable) { build_stubbed(issuable_type) }
subject { issuable.incident? }
it { is_expected.to eq(incident) }
end
end
end
......@@ -3,8 +3,9 @@
require 'spec_helper'
RSpec.describe IssueSerializer do
let(:resource) { create(:issue) }
let(:user) { create(:user) }
let_it_be(:resource) { create(:issue) }
let_it_be(:user) { create(:user) }
let(:json_entity) do
described_class.new(current_user: user)
.represent(resource, serializer: serializer)
......
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