redmine_airbrake_backend 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5926fca2b10cfdf572494c9891adc633b583bbdb
4
- data.tar.gz: 0dc91282b47937a48254ff1e3da0fbd4b555c0be
3
+ metadata.gz: 3e6852a17538390388bc5c1520c1b3c2eabf0b89
4
+ data.tar.gz: bd290d4558c8b9e30ef701345bc19c6d146b4637
5
5
  SHA512:
6
- metadata.gz: 58cfc22082b4c0098a5c756d915401fe334a3346c55541038b21fcd500978f5646ab7627234b5eb882f00561df2bbc28569de2b3c2976d1708c31857a59036ad
7
- data.tar.gz: 71de8ff6c61f7894afbafb4a763cef7402651beaac638f0756839a140fdc877c0ba7f6cc0466b5f39883b39460472ddd1531d968a37599b2aaaf772bd5c589ff
6
+ metadata.gz: 53fe81a2ff23a5d751e0877b3289667a26120574e23c7f128af98b3c1ab609d7ddc7eff83227bdb412b36251c58bf5d91b840704f9c5808968d124fee249fdf6
7
+ data.tar.gz: 21143a051e41b0da6f87ee20f14ffa5dad949c7cefa7a60e304a89183e651f6f771d0fcc37866516813a1ff95d291480a97d22d89ce7eb37d86f7e33be79c4ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1 (2016-05-18)
4
+ ### Fixes
5
+ - Add missing foreign_key option on issue category has many relation. Caused error on removing issue category
6
+
3
7
  ## 1.1.0 (2016-01-29)
4
8
  ### Fixes
5
9
  - Handle new ruby lambda backtrace syntax
@@ -1,17 +1,21 @@
1
1
  require 'tempfile'
2
2
  require 'redmine_airbrake_backend/notice'
3
3
 
4
-
5
4
  # Controller with airbrake related stuff
6
5
  class AirbrakeController < ::ApplicationController
7
6
  class InvalidRequest < StandardError; end
8
7
 
9
8
  skip_before_action :verify_authenticity_token
10
9
 
11
- prepend_before_action :load_records
12
10
  prepend_before_action :parse_key
13
11
  prepend_before_action :find_project
12
+
14
13
  before_action :authorize
14
+ before_action :find_tracker
15
+ before_action :find_category
16
+ before_action :find_priority
17
+ before_action :find_assignee
18
+ before_action :find_repository
15
19
 
16
20
  after_action :cleanup_tempfiles
17
21
 
@@ -24,31 +28,34 @@ class AirbrakeController < ::ApplicationController
24
28
  end
25
29
 
26
30
  def parse_key
27
- @key = JSON.parse(params[:key]).symbolize_keys rescue nil
31
+ @key = JSON.parse(params[:key]).with_indifferent_access rescue nil
28
32
 
29
33
  # API key
30
34
  invalid_request!('No or invalid API key') if @key.blank? || @key[:key].blank?
31
35
  params[:key] = @key[:key]
32
36
  end
33
37
 
34
- def load_records
35
- # Tracker
38
+ def find_tracker
36
39
  @tracker = record_for(@project.trackers, :tracker)
37
40
  invalid_request!('No or invalid tracker') if @tracker.blank?
38
41
 
39
- # Notice ID field
42
+ # Check notice ID field
40
43
  invalid_request!('Custom field for notice hash not available on selected tracker') if @tracker.custom_fields.find_by(id: notice_hash_field.id).blank?
44
+ end
41
45
 
42
- # Category
46
+ def find_category
43
47
  @category = record_for(@project.issue_categories, :category)
48
+ end
44
49
 
45
- # Priority
50
+ def find_priority
46
51
  @priority = record_for(IssuePriority, :priority) || IssuePriority.default
52
+ end
47
53
 
48
- # Assignee
54
+ def find_assignee
49
55
  @assignee = record_for(@project.users, :assignee, [:id, :login])
56
+ end
50
57
 
51
- # Repository
58
+ def find_repository
52
59
  @repository = @project.repositories.find_by(identifier: (@key[:repository] || ''))
53
60
  end
54
61
 
@@ -6,13 +6,7 @@ class AirbrakeProjectSettingsController < ::ApplicationController
6
6
  menu_item :settings
7
7
 
8
8
  def update
9
- @airbrake_project_setting.tracker_id = params[:airbrake_project_setting][:tracker_id]
10
- @airbrake_project_setting.category_id = params[:airbrake_project_setting][:category_id]
11
- @airbrake_project_setting.priority_id = params[:airbrake_project_setting][:priority_id]
12
- @airbrake_project_setting.reopen_regexp = params[:airbrake_project_setting][:reopen_regexp]
13
- @airbrake_project_setting.reopen_repeat_description = params[:airbrake_project_setting][:reopen_repeat_description]
14
-
15
- if @airbrake_project_setting.save
9
+ if @airbrake_project_setting.update(airbrake_project_setting_params)
16
10
  flash[:notice] = l(:notice_successful_update)
17
11
  end
18
12
 
@@ -29,4 +23,8 @@ class AirbrakeProjectSettingsController < ::ApplicationController
29
23
  @airbrake_project_setting = @project.airbrake_settings || AirbrakeProjectSetting.new
30
24
  @airbrake_project_setting.project = @project
31
25
  end
26
+
27
+ def airbrake_project_setting_params
28
+ params.require(:airbrake_project_setting).permit(:tracker_id, :category_id, :priority_id, :reopen_regexp, :reopen_repeat_description)
29
+ end
32
30
  end
@@ -1,6 +1,5 @@
1
1
  require 'redmine_airbrake_backend/ios_report'
2
2
 
3
-
4
3
  # Controller for airbrake reports
5
4
  class AirbrakeReportController < ::AirbrakeController
6
5
  accept_api_auth :ios_reports
@@ -18,7 +18,7 @@ module AirbrakeHelper
18
18
  if value.is_a?(String)
19
19
  lines << "|@#{key}@|@#{value}@|"
20
20
  elsif value.is_a?(Hash)
21
- lines << "|@#{key}@|@#{value.map { |k, v| "#{k}: #{v}"}.join(', ')}@|"
21
+ lines << "|@#{key}@|@#{value.map { |k, v| "#{k}: #{v}" }.join(', ')}@|"
22
22
  end
23
23
  end
24
24
 
@@ -55,6 +55,10 @@ module AirbrakeHelper
55
55
  markup + " in ??<notextile>#{element.function}</notextile>??"
56
56
  end
57
57
 
58
+ def airbrake_render_section(data, section)
59
+ render partial: 'airbrake/issue_description/section', locals: { data: data, section: section }
60
+ end
61
+
58
62
  private
59
63
 
60
64
  def airbrake_repository_for_backtrace_element(element)
@@ -0,0 +1,3 @@
1
+ h2. <%= section %>
2
+
3
+ <%= airbrake_format_table(data) %>
@@ -17,29 +17,13 @@ h2. Application:
17
17
  <% end %>
18
18
 
19
19
 
20
- <% if notice.params.present? %>
21
- h2. Parameters:
22
-
23
- <%= airbrake_format_table(notice.params) %>
24
- <% end %>
25
-
26
-
27
- <% if notice.session.present? %>
28
- h2. Session
29
-
30
- <%= airbrake_format_table(notice.session) %>
31
- <% end %>
20
+ <%= airbrake_render_section(notice.params, 'Parameters') %>
32
21
 
33
22
 
34
- <% if notice.context.present? %>
35
- h2. Context
23
+ <%= airbrake_render_section(notice.session, 'Session') %>
36
24
 
37
- <%= airbrake_format_table(notice.context) %>
38
- <% end %>
39
25
 
26
+ <%= airbrake_render_section(notice.context, 'Context') %>
40
27
 
41
- <% if notice.environment.present? %>
42
- h2. Environment
43
28
 
44
- <%= airbrake_format_table(notice.environment) %>
45
- <% end %>
29
+ <%= airbrake_render_section(notice.environment, 'Environment') %>
@@ -1,6 +1,5 @@
1
1
  require 'digest/md5'
2
2
 
3
-
4
3
  module RedmineAirbrakeBackend
5
4
  # Backtrace element received by airbrake
6
5
  class BacktraceElement
@@ -1,7 +1,6 @@
1
1
  require 'digest/md5'
2
2
  require 'redmine_airbrake_backend/backtrace_element'
3
3
 
4
-
5
4
  module RedmineAirbrakeBackend
6
5
  # Error received by airbrake
7
6
  class Error
@@ -1,6 +1,5 @@
1
1
  require 'redmine_airbrake_backend/notice'
2
2
 
3
-
4
3
  module RedmineAirbrakeBackend
5
4
  # iOS Report received by airbrake
6
5
  class IosReport < Notice
@@ -1,6 +1,5 @@
1
1
  require 'redmine_airbrake_backend/error'
2
2
 
3
-
4
3
  module RedmineAirbrakeBackend
5
4
  # Notice received by airbrake
6
5
  class Notice
@@ -5,7 +5,7 @@ module RedmineAirbrakeBackend::Patches
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- has_many :airbrake_project_settings, dependent: :nullify
8
+ has_many :airbrake_project_settings, foreign_key: :category_id, dependent: :nullify
9
9
  end
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
1
  module RedmineAirbrakeBackend
2
2
  # Version of this gem
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_airbrake_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-29 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -71,6 +71,7 @@ files:
71
71
  - app/controllers/airbrake_report_controller.rb
72
72
  - app/helpers/airbrake_helper.rb
73
73
  - app/models/airbrake_project_setting.rb
74
+ - app/views/airbrake/issue_description/_section.erb
74
75
  - app/views/airbrake/issue_description/default.erb
75
76
  - app/views/projects/settings/_airbrake.html.erb
76
77
  - app/views/settings/_airbrake.html.erb