Commit a36d844f authored by Michael Kozono's avatar Michael Kozono

Merge branch '36544-backend-add-ability-to-embed-stack-trace-in-gitlab-issue' into 'master'

Backend: Add ability to embed stack trace in gitlab issue

See merge request gitlab-org/gitlab!20799
parents d53dbd77 9c5f8fdd
...@@ -279,19 +279,30 @@ module IssuablesHelper ...@@ -279,19 +279,30 @@ module IssuablesHelper
initialDescriptionText: issuable.description, initialDescriptionText: issuable.description,
initialTaskStatus: issuable.task_status initialTaskStatus: issuable.task_status
} }
data.merge!(issue_only_initial_data(issuable))
data.merge!(path_data(parent))
data.merge!(updated_at_by(issuable))
data
end
data[:hasClosingMergeRequest] = issuable.merge_requests_count(current_user) != 0 if issuable.is_a?(Issue) def issue_only_initial_data(issuable)
data[:zoomMeetingUrl] = ZoomMeeting.canonical_meeting_url(issuable) if issuable.is_a?(Issue) return {} unless issuable.is_a?(Issue)
if parent.is_a?(Group) {
data[:groupPath] = parent.path hasClosingMergeRequest: issuable.merge_requests_count(current_user) != 0,
else zoomMeetingUrl: ZoomMeeting.canonical_meeting_url(issuable),
data.merge!(projectPath: ref_project.path, projectNamespace: ref_project.namespace.full_path) sentryIssueIdentifier: SentryIssue.find_by(issue: issuable)&.sentry_issue_identifier # rubocop:disable CodeReuse/ActiveRecord
}
end end
data.merge!(updated_at_by(issuable)) def path_data(parent)
return { groupPath: parent.path } if parent.is_a?(Group)
data {
projectPath: ref_project.path,
projectNamespace: ref_project.namespace.full_path
}
end end
def updated_at_by(issuable) def updated_at_by(issuable)
......
...@@ -202,6 +202,26 @@ describe IssuablesHelper do ...@@ -202,6 +202,26 @@ describe IssuablesHelper do
expect(helper.issuable_initial_data(issue)).to match(hash_including(expected_data)) expect(helper.issuable_initial_data(issue)).to match(hash_including(expected_data))
end 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 describe '#zoomMeetingUrl in issue' do
let(:issue) { create(:issue, author: user) } 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