diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-30 16:10:39 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-30 16:35:27 -0400 |
commit | 0027c2ddd78942e7fc266f68ccfdb17e2a525554 (patch) | |
tree | 1ade63953dfbbaa409f2faf48c1320cb928d4574 /app/models/project.rb | |
parent | 466bec7caa4708f3d0c671b9fab135ed2c3dcdc1 (diff) | |
download | gitlab-ce-0027c2ddd78942e7fc266f68ccfdb17e2a525554.tar.gz |
Add Project#get_issue
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 397232e98d8..e8a0b2f115f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -329,14 +329,18 @@ class Project < ActiveRecord::Base self.id end - def issue_exists?(issue_id) + def get_issue(issue_id) if default_issues_tracker? - self.issues.where(iid: issue_id).first.present? + issues.find_by(iid: issue_id) else - true + ExternalIssue.new(issue_id, self) end end + def issue_exists?(issue_id) + get_issue(issue_id).present? + end + def default_issue_tracker gitlab_issue_tracker_service || create_gitlab_issue_tracker_service end @@ -350,11 +354,7 @@ class Project < ActiveRecord::Base end def default_issues_tracker? - if external_issue_tracker - false - else - true - end + external_issue_tracker.blank? end def external_issues_trackers |