Commit 9230e97b authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-error-tracking-details-loading-for-non-owners' into 'master'

Ensure the proj route is correct for error details

See merge request gitlab-org/gitlab!20320
parents f3f04ae3 5d5d0ee3
......@@ -2,6 +2,7 @@
class Projects::ErrorTrackingController < Projects::ApplicationController
before_action :authorize_read_sentry_issue!
before_action :set_issue_id, only: [:details, :stack_trace]
POLLING_INTERVAL = 10_000
......@@ -113,6 +114,10 @@ class Projects::ErrorTrackingController < Projects::ApplicationController
params.permit(:issue_id)
end
def set_issue_id
@issue_id = issue_details_params[:issue_id]
end
def set_polling_interval
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
end
......
......@@ -14,12 +14,12 @@ module Projects::ErrorTrackingHelper
}
end
def error_details_data(project, issue)
opts = [project, issue, { format: :json }]
def error_details_data(project, issue_id)
opts = [project, issue_id, { format: :json }]
{
'issue-details-path' => details_namespace_project_error_tracking_index_path(*opts),
'issue-stack-trace-path' => stack_trace_namespace_project_error_tracking_index_path(*opts)
'issue-details-path' => details_project_error_tracking_index_path(*opts),
'issue-stack-trace-path' => stack_trace_project_error_tracking_index_path(*opts)
}
end
end
- page_title _('Error Details')
- add_to_breadcrumbs 'Errors', project_error_tracking_index_path(@project)
#js-error_details{ data: error_details_data(@current_user, @project) }
#js-error_details{ data: error_details_data(@project, @issue_id) }
......@@ -75,4 +75,21 @@ describe Projects::ErrorTrackingHelper do
end
end
end
describe '#error_details_data' do
let(:issue_id) { 1234 }
let(:route_params) { [project.owner, project, issue_id, { format: :json }] }
let(:details_path) { details_namespace_project_error_tracking_index_path(*route_params) }
let(:stack_trace_path) { stack_trace_namespace_project_error_tracking_index_path(*route_params) }
let(:result) { helper.error_details_data(project, issue_id) }
it 'returns the correct details path' do
expect(result['issue-details-path']).to eq details_path
end
it 'returns the correct stack trace path' do
expect(result['issue-stack-trace-path']).to eq stack_trace_path
end
end
end
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