Commit 8cd0c6cd458bc639fc3af542725ed9876cf7434b
1 parent
029ed1f6
Exists in
master
and in
1 other branch
[#227] Page to redirect from notice ID to problem page, so we can now use the ID…
… shown at 500.html inside monitored app.
Showing
3 changed files
with
26 additions
and
0 deletions
Show diff stats
app/controllers/notices_controller.rb
| ... | ... | @@ -6,5 +6,11 @@ class NoticesController < ApplicationController |
| 6 | 6 | @notice = App.report_error!(params[:data] || request.raw_post) |
| 7 | 7 | render :xml => @notice |
| 8 | 8 | end |
| 9 | + | |
| 10 | + # Redirects a notice to the problem page. Useful when using User Information at Airbrake gem. | |
| 11 | + def locate | |
| 12 | + problem = Notice.find(params[:id]).problem | |
| 13 | + redirect_to app_err_path(problem.app, problem) | |
| 14 | + end | |
| 9 | 15 | end |
| 10 | 16 | ... | ... |
config/routes.rb
spec/controllers/notices_controller_spec.rb
| 1 | 1 | require 'spec_helper' |
| 2 | 2 | |
| 3 | 3 | describe NoticesController do |
| 4 | + it_requires_authentication :for => { :locate => :get } | |
| 5 | + | |
| 6 | + let(:app) { Fabricate(:app) } | |
| 4 | 7 | |
| 5 | 8 | context 'notices API' do |
| 6 | 9 | before do |
| ... | ... | @@ -44,5 +47,21 @@ describe NoticesController do |
| 44 | 47 | end |
| 45 | 48 | end |
| 46 | 49 | |
| 50 | + describe "GET /locate/:id" do | |
| 51 | + context 'when logged in as an admin' do | |
| 52 | + before(:each) do | |
| 53 | + @user = Fabricate(:admin) | |
| 54 | + sign_in @user | |
| 55 | + end | |
| 56 | + | |
| 57 | + it "should locate notice and redirect to problem" do | |
| 58 | + problem = Fabricate(:problem, :app => app, :environment => "production") | |
| 59 | + notice = Fabricate(:notice, :err => Fabricate(:err, :problem => problem)) | |
| 60 | + get :locate, :id => notice.id | |
| 61 | + response.should redirect_to(app_err_path(problem.app, problem)) | |
| 62 | + end | |
| 63 | + end | |
| 64 | + end | |
| 65 | + | |
| 47 | 66 | end |
| 48 | 67 | ... | ... |