diff --git a/app/helpers/errs_helper.rb b/app/helpers/errs_helper.rb index d772739..cd99153 100644 --- a/app/helpers/errs_helper.rb +++ b/app/helpers/errs_helper.rb @@ -8,11 +8,11 @@ module ErrsHelper Errbit::Config.confirm_resolve_err === false ? nil : 'Seriously?' end - def link_to_github app, notice + def link_to_github app, notice, text=nil file_name = notice.top_in_app_backtrace_line['file'].split('/').last file_path = notice.top_in_app_backtrace_line['file'].gsub('[PROJECT_ROOT]', '') line_number = notice.top_in_app_backtrace_line['number'] - link_to(file_name, "#{app.github_url_to_file(file_path)}#L#{line_number}", :target => '_blank') + link_to(text || file_name, "#{app.github_url_to_file(file_path)}#L#{line_number}", :target => '_blank') end end \ No newline at end of file diff --git a/app/models/notice.rb b/app/models/notice.rb index 5696b45..7ad3e51 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -56,6 +56,10 @@ class Notice agent_string.blank? ? nil : UserAgent.parse(agent_string) end + def self.in_app_backtrace_line? line + line['file'] =~ %r{^\[PROJECT_ROOT\]/(?!(vendor))} + end + def request read_attribute(:request) || {} end @@ -81,7 +85,7 @@ class Notice end def top_in_app_backtrace_line - @top_in_app_backtrace_line ||= self.backtrace.find {|line| line['file'] =~ %r{^\[PROJECT_ROOT\]/(?!(vendor))} } + @top_in_app_backtrace_line ||= self.backtrace.find {|line| Notice.in_app_backtrace_line?(line) } end protected @@ -122,4 +126,3 @@ class Notice end end end - diff --git a/app/views/notices/_backtrace.html.haml b/app/views/notices/_backtrace.html.haml index 322a47e..54c0622 100644 --- a/app/views/notices/_backtrace.html.haml +++ b/app/views/notices/_backtrace.html.haml @@ -4,7 +4,8 @@ %th %ul.line-numbers - lines.each do |line| - %li= line['number'] + %li= (@app.github_url? && Notice.in_app_backtrace_line?(line)) ? link_to_github(@app, @notice, line['number']) : line['number'] + %td %ul.lines - lines.each do |line| diff --git a/app/views/notices/_summary.html.haml b/app/views/notices/_summary.html.haml index 22ae1aa..904b486 100644 --- a/app/views/notices/_summary.html.haml +++ b/app/views/notices/_summary.html.haml @@ -19,7 +19,3 @@ %tr %th Browser %td= user_agent_graph(notice.err) - - if @app.github_url? - %tr - %th GitHub - %td= link_to_github(@app, notice) -- libgit2 0.21.2