Commit 37be920a6ec5ba9299d49891cc5620fe53221ad3
1 parent
7ef18d79
Exists in
master
and in
1 other branch
Remove some github specific configs, need to be on the plugin
Showing
4 changed files
with
9 additions
and
24 deletions
Show diff stats
app/controllers/problems_controller.rb
... | ... | @@ -63,8 +63,9 @@ class ProblemsController < ApplicationController |
63 | 63 | |
64 | 64 | def create_issue |
65 | 65 | body = "" # TODO render_issue_body |
66 | - title = "" # TODO generate_title | |
67 | - issue = Issue.new(issue_tracker: problem.app.issue_tracker, user: current_user, title: title, body: body) | |
66 | + title = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | |
67 | + | |
68 | + issue = Issue.new(problem: problem, user: current_user, title: title, body: body) | |
68 | 69 | unless issue.save |
69 | 70 | flash[:error] = issue.errors.full_messages.join(', ') |
70 | 71 | end | ... | ... |
app/models/issue_tracker.rb
... | ... | @@ -13,7 +13,7 @@ class IssueTracker |
13 | 13 | @tracker ||= |
14 | 14 | begin |
15 | 15 | klass = ErrbitPlugin::Registry.issue_trackers[self.type_tracker] || ErrbitPlugin::NoneIssueTracker |
16 | - klass.new(self.options) | |
16 | + klass.new(options.merge(github_repo: app.github_repo, bitbucket_repo: app.bitbucket_repo)) | |
17 | 17 | end |
18 | 18 | end |
19 | 19 | ... | ... |
app/views/problems/_issue_tracker_links.html.haml
1 | -- if app.issue_tracker_configured? || current_user.github_account? | |
1 | +- if app.issue_tracker_configured? | |
2 | 2 | - if problem.issue_link.present? |
3 | 3 | %span= link_to 'go to issue', problem.issue_link, :class => "#{problem.issue_type}_goto goto-issue" |
4 | 4 | = link_to 'unlink issue', unlink_issue_app_problem_path(app, problem), :method => :delete, :data => { :confirm => "Unlink err issues?" }, :class => "unlink-issue" |
... | ... | @@ -6,10 +6,4 @@ |
6 | 6 | %span.disabled= link_to 'creating...', '#', :class => "#{problem.issue_type}_inactive create-issue" |
7 | 7 | = link_to 'retry', create_issue_app_problem_path(app, problem), :method => :post |
8 | 8 | - else |
9 | - - if app.issue_tracker_configured? && !app.issue_tracker.type_tracker.eql?('github') | |
10 | - %span= link_to 'create issue', create_issue_app_problem_path(app, problem), :method => :post, :class => "#{app.issue_tracker.type_tracker}_create create-issue" | |
11 | - - elsif app.github_repo? | |
12 | - - if current_user.can_create_github_issues? | |
13 | - %span= link_to 'create issue', create_issue_app_problem_path(app, problem, :tracker => 'user_github'), :method => :post, :class => "github_create create-issue" | |
14 | - - elsif app.issue_tracker_configured? && app.issue_tracker.type_tracker.eql?('github') | |
15 | - %span= link_to 'create issue', create_issue_app_problem_path(app, problem), :method => :post, :class => "github_create create-issue" | |
9 | + %span= link_to 'create issue', create_issue_app_problem_path(app, problem), method: :post, class: "#{app.issue_tracker.type_tracker}_create create-issue" | ... | ... |
spec/views/problems/show.html.haml_spec.rb
... | ... | @@ -81,26 +81,16 @@ describe "problems/show.html.haml" do |
81 | 81 | end |
82 | 82 | |
83 | 83 | context 'create issue links' do |
84 | - it 'should allow creating issue for github if current user has linked their github account' do | |
85 | - user = Fabricate(:user, :github_login => 'test_user', :github_oauth_token => 'abcdef') | |
86 | - controller.stub(:current_user) { user } | |
87 | - | |
88 | - problem = Fabricate(:problem_with_comments, :app => Fabricate(:app, :github_repo => "test_user/test_repo")) | |
89 | - view.stub(:problem).and_return(problem) | |
90 | - view.stub(:app).and_return(problem.app) | |
91 | - render | |
92 | - | |
93 | - expect(action_bar).to have_selector("span a.github_create.create-issue", :text => 'create issue') | |
94 | - end | |
84 | + let(:app) { Fabricate(:app, :github_repo => "test_user/test_repo") } | |
95 | 85 | |
96 | 86 | it 'should allow creating issue for github if application has a github tracker' do |
97 | - problem = Fabricate(:problem_with_comments, :app => Fabricate(:app, :github_repo => "test_user/test_repo")) | |
87 | + problem = Fabricate(:problem_with_comments, app: app) | |
98 | 88 | with_issue_tracker("github", problem) |
99 | 89 | view.stub(:problem).and_return(problem) |
100 | 90 | view.stub(:app).and_return(problem.app) |
101 | 91 | render |
102 | 92 | |
103 | - expect(action_bar).to have_selector("span a.github_create.create-issue", :text => 'create issue') | |
93 | + expect(action_bar).to have_selector("span a.github_create.create-issue", text: 'create issue') | |
104 | 94 | end |
105 | 95 | |
106 | 96 | context "without issue tracker associate on app" do | ... | ... |