Commit fce5547da0a685295b0ea0d563c16dc93da2a8d5

Authored by Nathan Broadbent
1 parent 74e12968
Exists in master and in 1 other branch production

Pass current_user to issue tracker's #create_issue method, for setting 'reported_by' fields

app/controllers/errs_controller.rb
@@ -39,7 +39,7 @@ class ErrsController < ApplicationController @@ -39,7 +39,7 @@ class ErrsController < ApplicationController
39 set_tracker_params 39 set_tracker_params
40 40
41 if @app.issue_tracker 41 if @app.issue_tracker
42 - @app.issue_tracker.create_issue @problem 42 + @app.issue_tracker.create_issue @problem, current_user
43 else 43 else
44 flash[:error] = "This app has no issue tracker setup." 44 flash[:error] = "This app has no issue tracker setup."
45 end 45 end
app/models/issue_trackers/fogbugz_tracker.rb
@@ -22,7 +22,7 @@ class IssueTrackers::FogbugzTracker < IssueTracker @@ -22,7 +22,7 @@ class IssueTrackers::FogbugzTracker < IssueTracker
22 end 22 end
23 end 23 end
24 24
25 - def create_issue(problem) 25 + def create_issue(problem, reported_by)
26 fogbugz = Fogbugz::Interface.new(:email => username, :password => password, :uri => "https://#{account}.fogbugz.com") 26 fogbugz = Fogbugz::Interface.new(:email => username, :password => password, :uri => "https://#{account}.fogbugz.com")
27 fogbugz.authenticate 27 fogbugz.authenticate
28 28
app/models/issue_trackers/github_issues_tracker.rb
@@ -19,10 +19,10 @@ class IssueTrackers::GithubIssuesTracker < IssueTracker @@ -19,10 +19,10 @@ class IssueTrackers::GithubIssuesTracker < IssueTracker
19 end 19 end
20 end 20 end
21 21
22 - def create_issue(err) 22 + def create_issue(problem, reported_by)
23 client = Octokit::Client.new(:login => username, :token => api_token) 23 client = Octokit::Client.new(:login => username, :token => api_token)
24 - issue = client.create_issue(project_id, issue_title(err), body_template.result(binding).unpack('C*').pack('U*'), options = {})  
25 - err.update_attribute :issue_link, issue.html_url 24 + issue = client.create_issue(project_id, issue_title(problem), body_template.result(binding).unpack('C*').pack('U*'), options = {})
  25 + problem.update_attribute :issue_link, issue.html_url
26 end 26 end
27 27
28 def body_template 28 def body_template
app/models/issue_trackers/lighthouse_tracker.rb
@@ -18,7 +18,7 @@ class IssueTrackers::LighthouseTracker < IssueTracker @@ -18,7 +18,7 @@ class IssueTrackers::LighthouseTracker < IssueTracker
18 end 18 end
19 end 19 end
20 20
21 - def create_issue(problem) 21 + def create_issue(problem, reported_by)
22 Lighthouse.account = account 22 Lighthouse.account = account
23 Lighthouse.token = api_token 23 Lighthouse.token = api_token
24 # updating lighthouse account 24 # updating lighthouse account
app/models/issue_trackers/mingle_tracker.rb
@@ -27,7 +27,7 @@ class IssueTrackers::MingleTracker < IssueTracker @@ -27,7 +27,7 @@ class IssueTrackers::MingleTracker < IssueTracker
27 end 27 end
28 end 28 end
29 29
30 - def create_issue(problem) 30 + def create_issue(problem, reported_by)
31 properties = ticket_properties_hash 31 properties = ticket_properties_hash
32 basic_auth = account.gsub(/https?:\/\//, "https://#{username}:#{password}@") 32 basic_auth = account.gsub(/https?:\/\//, "https://#{username}:#{password}@")
33 Mingle.set_site "#{basic_auth}/api/v1/projects/#{project_id}/" 33 Mingle.set_site "#{basic_auth}/api/v1/projects/#{project_id}/"
app/models/issue_trackers/pivotal_labs_tracker.rb
@@ -13,7 +13,7 @@ class IssueTrackers::PivotalLabsTracker < IssueTracker @@ -13,7 +13,7 @@ class IssueTrackers::PivotalLabsTracker < IssueTracker
13 end 13 end
14 end 14 end
15 15
16 - def create_issue(problem) 16 + def create_issue(problem, reported_by)
17 PivotalTracker::Client.token = api_token 17 PivotalTracker::Client.token = api_token
18 PivotalTracker::Client.use_ssl = true 18 PivotalTracker::Client.use_ssl = true
19 project = PivotalTracker::Project.find project_id.to_i 19 project = PivotalTracker::Project.find project_id.to_i
app/models/issue_trackers/redmine_tracker.rb
@@ -25,7 +25,7 @@ class IssueTrackers::RedmineTracker < IssueTracker @@ -25,7 +25,7 @@ class IssueTrackers::RedmineTracker < IssueTracker
25 end 25 end
26 end 26 end
27 27
28 - def create_issue(problem) 28 + def create_issue(problem, reported_by)
29 token = api_token 29 token = api_token
30 acc = account 30 acc = account
31 RedmineClient::Base.configure do 31 RedmineClient::Base.configure do
app/views/issue_trackers/github_issues_body.txt.erb
1 -[See this exception on Errbit](<%= app_err_url err.app, err %> "See this exception on Errbit")  
2 -<% if notice = err.notices.first %> 1 +[See this exception on Errbit](<%= app_err_url problem.app, problem %> "See this exception on Errbit")
  2 +<% if notice = problem.notices.first %>
3 # <%= notice.message %> # 3 # <%= notice.message %> #
4 ## Summary ## 4 ## Summary ##
5 <% if notice.request['url'].present? %> 5 <% if notice.request['url'].present? %>