Skip to content

Commit

Permalink
Added an optional tracker_id field
Browse files Browse the repository at this point in the history
Defining a tracker_id, will make sure that
the ticket will be created with the right "type".

If it is not filled, then it fallbacks to default
which is the first type available to the project
in the priority list.
  • Loading branch information
brodock committed Dec 7, 2014
1 parent f84ed2f commit 84a04a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/errbit_redmine_plugin/issue_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class IssueTracker < ErrbitPlugin::IssueTracker
:optional => true,
:label => "App Project",
:placeholder => "Where app's files & revisions can be viewed. (Leave blank to use the above project by default)"
}],
[:tracker_id, {
:optional => true,
:label => "Issue Tracker Id",
:placeholder => "The tracker where tickets will be created. (Leave blank to use default)"
}]
]

Expand Down Expand Up @@ -82,6 +87,7 @@ def create_issue(problem, reported_by = nil)
user = params['username']
passwd = params['password']
project_id = params['project_id']
tracker_id = params['tracker_id']

RedmineClient::Base.configure do
self.token = token
Expand All @@ -94,6 +100,7 @@ def create_issue(problem, reported_by = nil)
issue = RedmineClient::Issue.new(:project_id => project_id)
issue.subject = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}"
issue.description = self.class.body_template.result(binding)
issue.tracker_id = tracker_id if tracker_id.present?
issue.save!

problem.update_attributes(
Expand Down

0 comments on commit 84a04a3

Please sign in to comment.