Commit c8d37823e2d530d2433f8ca1b6ae5b3318e7c8f8

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

Allow the option to leave comments on errs even if an issue tracker is configured for the app.

app/views/errs/show.html.haml
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 - if @err.unresolved? 20 - if @err.unresolved?
21 %span= link_to 'resolve', resolve_app_err_path(@app, @err), :method => :put, :confirm => err_confirm, :class => 'resolve' 21 %span= link_to 'resolve', resolve_app_err_path(@app, @err), :method => :put, :confirm => err_confirm, :class => 'resolve'
22 22
23 -- if !@app.issue_tracker_configured? || @err.comments.any? 23 +- if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @err.comments.any?
24 - content_for :comments do 24 - content_for :comments do
25 %h3 Comments on this Err 25 %h3 Comments on this Err
26 - @err.comments.each do |comment| 26 - @err.comments.each do |comment|
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 = link_to comment.user.email, user_path(comment.user) 33 = link_to comment.user.email, user_path(comment.user)
34 %tr 34 %tr
35 %td= comment.body.gsub("\n", "<br>").html_safe 35 %td= comment.body.gsub("\n", "<br>").html_safe
36 - - unless @app.issue_tracker_configured? 36 + - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured?
37 = form_for @comment, :url => create_comment_app_err_path(@app, @err) do |comment_form| 37 = form_for @comment, :url => create_comment_app_err_path(@app, @err) do |comment_form|
38 %p Add a comment 38 %p Add a comment
39 = comment_form.text_area :body, :style => "width: 420px; height: 80px;" 39 = comment_form.text_area :body, :style => "width: 420px; height: 80px;"
config/config.example.yml
@@ -31,6 +31,10 @@ confirm_resolve_err: true @@ -31,6 +31,10 @@ confirm_resolve_err: true
31 # Helpful when you need to plug in a custom authentication strategy, such as LDAP. 31 # Helpful when you need to plug in a custom authentication strategy, such as LDAP.
32 user_has_username: false 32 user_has_username: false
33 33
  34 +# Allow comments while an issue tracker is configured.
  35 +# This is useful when you don't need to create a ticket,
  36 +# and you want to attach a short note to the err.
  37 +allow_comments_with_issue_tracker: true
34 38
35 # Configure SMTP settings. If you are running Errbit on Heroku, 39 # Configure SMTP settings. If you are running Errbit on Heroku,
36 # sendgrid will be configured by default. 40 # sendgrid will be configured by default.
spec/views/errs/show.html.haml_spec.rb
@@ -38,7 +38,11 @@ describe &quot;errs/show.html.haml&quot; do @@ -38,7 +38,11 @@ describe &quot;errs/show.html.haml&quot; do
38 38
39 end 39 end
40 40
41 - describe "content_for :comments" do 41 + describe "content_for :comments with comments disabled for configured issue tracker" do
  42 + before do
  43 + Errbit::Config.stub(:allow_comments_with_issue_tracker).and_return(false)
  44 + end
  45 +
42 it 'should display comments and new comment form when no issue tracker' do 46 it 'should display comments and new comment form when no issue tracker' do
43 err = Factory(:err_with_comments) 47 err = Factory(:err_with_comments)
44 assign :err, err 48 assign :err, err