Commit 9c5f8fdd authored by Allison Browne's avatar Allison Browne Committed by Michael Kozono

Add table to story sentry issues

Add table to store the sentry event and issue ids
that are related to a gitlab issue
parent d53dbd77
......@@ -279,19 +279,30 @@ module IssuablesHelper
initialDescriptionText: issuable.description,
initialTaskStatus: issuable.task_status
}
data.merge!(issue_only_initial_data(issuable))
data.merge!(path_data(parent))
data.merge!(updated_at_by(issuable))
data[:hasClosingMergeRequest] = issuable.merge_requests_count(current_user) != 0 if issuable.is_a?(Issue)
data[:zoomMeetingUrl] = ZoomMeeting.canonical_meeting_url(issuable) if issuable.is_a?(Issue)
data
end
if parent.is_a?(Group)
data[:groupPath] = parent.path
else
data.merge!(projectPath: ref_project.path, projectNamespace: ref_project.namespace.full_path)
end
def issue_only_initial_data(issuable)
return {} unless issuable.is_a?(Issue)
data.merge!(updated_at_by(issuable))
{
hasClosingMergeRequest: issuable.merge_requests_count(current_user) != 0,
zoomMeetingUrl: ZoomMeeting.canonical_meeting_url(issuable),
sentryIssueIdentifier: SentryIssue.find_by(issue: issuable)&.sentry_issue_identifier # rubocop:disable CodeReuse/ActiveRecord
}
end
data
def path_data(parent)
return { groupPath: parent.path } if parent.is_a?(Group)
{
projectPath: ref_project.path,
projectNamespace: ref_project.namespace.full_path
}
end
def updated_at_by(issuable)
......
......@@ -202,6 +202,26 @@ describe IssuablesHelper do
expect(helper.issuable_initial_data(issue)).to match(hash_including(expected_data))
end
describe '#sentryIssueIdentifier' do
let(:issue) { create(:issue, author: user) }
before do
assign(:project, issue.project)
end
it 'sets sentryIssueIdentifier to nil with no sentry issue ' do
expect(helper.issuable_initial_data(issue)[:sentryIssueIdentifier])
.to be_nil
end
it 'sets sentryIssueIdentifier to sentry_issue_identifier' do
sentry_issue = create(:sentry_issue, issue: issue)
expect(helper.issuable_initial_data(issue)[:sentryIssueIdentifier])
.to eq(sentry_issue.sentry_issue_identifier)
end
end
describe '#zoomMeetingUrl in issue' do
let(:issue) { create(:issue, author: user) }
......
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