diff --git a/app/graphql/types/work_item_type.rb b/app/graphql/types/work_item_type.rb
index d2a18e595e8..6b259ad291e 100644
--- a/app/graphql/types/work_item_type.rb
+++ b/app/graphql/types/work_item_type.rb
@@ -27,6 +27,9 @@ module Types
description: 'Global ID of the work item.'
field :iid, GraphQL::Types::String, null: false,
description: 'Internal ID of the work item.'
+ field :imported, GraphQL::Types::Boolean, null: false,
+ method: :imported?,
+ description: 'Indicates whether the work item was imported.'
field :lock_version,
GraphQL::Types::Int,
null: false,
diff --git a/app/models/work_item.rb b/app/models/work_item.rb
index 7f6066475f3..c8c48d012b6 100644
--- a/app/models/work_item.rb
+++ b/app/models/work_item.rb
@@ -2,6 +2,7 @@
class WorkItem < Issue
include Gitlab::Utils::StrongMemoize
+ include Import::HasImportSource
COMMON_QUICK_ACTIONS_COMMANDS = [
:title, :reopen, :close, :cc, :tableflip, :shrug, :type, :promote_to, :checkin_reminder,
diff --git a/app/services/system_notes/time_tracking_service.rb b/app/services/system_notes/time_tracking_service.rb
index 53f4b7e9116..3b5801fa568 100644
--- a/app/services/system_notes/time_tracking_service.rb
+++ b/app/services/system_notes/time_tracking_service.rb
@@ -113,7 +113,8 @@ module SystemNotes
def formatted_spent_at(spent_at)
spent_at ||= DateTime.current
- timezone = author.timezone || Time.zone.name
+ timezone = author.timezone
+ timezone = Time.zone.name if timezone.blank? || ActiveSupport::TimeZone[timezone].nil?
spent_at.in_time_zone(timezone)
end
diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md
index 6526a20f250..2894dfb5140 100644
--- a/doc/api/graphql/reference/_index.md
+++ b/doc/api/graphql/reference/_index.md
@@ -41656,6 +41656,7 @@ four standard [pagination arguments](#pagination-arguments):
| `hidden` | [`Boolean`](#boolean) | Indicates the work item is hidden because the author has been banned. |
| `id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. |
| `iid` | [`String!`](#string) | Internal ID of the work item. |
+| `imported` | [`Boolean!`](#boolean) | Indicates whether the work item was imported. |
| `lockVersion` | [`Int!`](#int) | Lock version of the work item. Incremented each time the work item is updated. |
| `movedToWorkItemUrl` | [`String`](#string) | URL of the work item that the work item was moved to. |
| `name` | [`String`](#string) | Name or title of the object. |
diff --git a/spec/graphql/types/work_item_type_spec.rb b/spec/graphql/types/work_item_type_spec.rb
index ffdadf4569b..a92a8ba836b 100644
--- a/spec/graphql/types/work_item_type_spec.rb
+++ b/spec/graphql/types/work_item_type_spec.rb
@@ -19,6 +19,7 @@ RSpec.describe GitlabSchema.types['WorkItem'], feature_category: :team_planning
description_html
id
iid
+ imported
lock_version
namespace
project
diff --git a/spec/services/system_notes/time_tracking_service_spec.rb b/spec/services/system_notes/time_tracking_service_spec.rb
index b815530d82a..cc67e94c405 100644
--- a/spec/services/system_notes/time_tracking_service_spec.rb
+++ b/spec/services/system_notes/time_tracking_service_spec.rb
@@ -383,6 +383,26 @@ RSpec.describe ::SystemNotes::TimeTrackingService, feature_category: :team_plann
end
end
+ context 'when author timezone is blank' do
+ let(:author) { create(:user, timezone: '') }
+
+ it 'sets the note text using default timezone' do
+ spend_time!(277200)
+
+ expect(subject.note).to eq "added 1w 4d 5h of time spent at 2019-12-30 14:05:12 UTC"
+ end
+ end
+
+ context 'when author timezone is invalid' do
+ let(:author) { create(:user, timezone: 'GitLab') }
+
+ it 'sets the note text using default timezone' do
+ spend_time!(277200)
+
+ expect(subject.note).to eq "added 1w 4d 5h of time spent at 2019-12-30 14:05:12 UTC"
+ end
+ end
+
context 'when time was subtracted' do
it 'sets the note text' do
spend_time!(360000)