Commit 80ab7ea5b440d6b28b591bec11e2622b2f8ed7d6
1 parent
2bd7dbf1
Exists in
master
and in
1 other branch
Remove allow_comments_with_issue_tracker config
Showing
10 changed files
with
33 additions
and
97 deletions
Show diff stats
app/models/app.rb
| ... | ... | @@ -175,13 +175,6 @@ class App |
| 175 | 175 | update_attribute(:api_key, SecureRandom.hex) |
| 176 | 176 | end |
| 177 | 177 | |
| 178 | - ## | |
| 179 | - # Check if comments can be allowed on this application | |
| 180 | - # | |
| 181 | - def comments_allowed? | |
| 182 | - !issue_tracker || issue_tracker.comments_allowed? | |
| 183 | - end | |
| 184 | - | |
| 185 | 178 | protected |
| 186 | 179 | |
| 187 | 180 | def store_cached_attributes_on_problems | ... | ... |
app/models/issue_tracker.rb
app/models/problem.rb
| ... | ... | @@ -73,10 +73,6 @@ class Problem |
| 73 | 73 | Notice.for_errs(errs).ordered |
| 74 | 74 | end |
| 75 | 75 | |
| 76 | - def comments_allowed? | |
| 77 | - Errbit::Config.allow_comments_with_issue_tracker || app.comments_allowed? | |
| 78 | - end | |
| 79 | - | |
| 80 | 76 | def resolve! |
| 81 | 77 | self.update_attributes!(:resolved => true, :resolved_at => Time.now) |
| 82 | 78 | end | ... | ... |
app/views/problems/show.html.haml
| ... | ... | @@ -22,32 +22,30 @@ |
| 22 | 22 | %br |
| 23 | 23 | = render "issue_tracker_links" |
| 24 | 24 | |
| 25 | -- if problem.comments_allowed? || problem.comments.any? | |
| 26 | - - content_for :comments do | |
| 27 | - %h3 Comments | |
| 28 | - - problem.comments.each do |comment| | |
| 29 | - .window | |
| 30 | - %table.comment | |
| 31 | - %tr | |
| 32 | - %th | |
| 33 | - - if comment.user | |
| 34 | - - if Errbit::Config.use_gravatar | |
| 35 | - = gravatar_tag comment.user.email, :s => 24 | |
| 36 | - %span.comment-info | |
| 37 | - = time_ago_in_words(comment.created_at, include_seconds: true) << " ago by " | |
| 38 | - = link_to comment.user.email, comment.user | |
| 39 | - - else | |
| 40 | - %span.comment-info | |
| 41 | - = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]" | |
| 42 | - %span.delete= link_to '✘'.html_safe, [app, problem, comment], :method => :delete, | |
| 43 | - :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment" | |
| 44 | - %tr | |
| 45 | - %td= simple_format comment.body | |
| 46 | - - if problem.comments_allowed? | |
| 47 | - = form_for [app, problem, @comment] do |comment_form| | |
| 48 | - %p Add a comment | |
| 49 | - = comment_form.text_area :body | |
| 50 | - = comment_form.submit "Save Comment" | |
| 25 | +- content_for :comments do | |
| 26 | + %h3 Comments | |
| 27 | + - problem.comments.each do |comment| | |
| 28 | + .window | |
| 29 | + %table.comment | |
| 30 | + %tr | |
| 31 | + %th | |
| 32 | + - if comment.user | |
| 33 | + - if Errbit::Config.use_gravatar | |
| 34 | + = gravatar_tag comment.user.email, :s => 24 | |
| 35 | + %span.comment-info | |
| 36 | + = time_ago_in_words(comment.created_at, include_seconds: true) << " ago by " | |
| 37 | + = link_to comment.user.email, comment.user | |
| 38 | + - else | |
| 39 | + %span.comment-info | |
| 40 | + = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]" | |
| 41 | + %span.delete= link_to '✘'.html_safe, [app, problem, comment], :method => :delete, | |
| 42 | + :data => { :confirm => t("comments.confirm_delete") }, :class => "destroy-comment" | |
| 43 | + %tr | |
| 44 | + %td= simple_format comment.body | |
| 45 | + = form_for [app, problem, @comment] do |comment_form| | |
| 46 | + %p Add a comment | |
| 47 | + = comment_form.text_area :body | |
| 48 | + = comment_form.submit "Save Comment" | |
| 51 | 49 | |
| 52 | 50 | %h4= @notice.try(:message) |
| 53 | 51 | ... | ... |
config/cloud/cloud66/files/_load_config.rb
| ... | ... | @@ -11,7 +11,6 @@ unless defined?(Errbit::Config) |
| 11 | 11 | # Errbit::Config.email_at_notices = ENV['ERRBIT_EMAIL_AT_NOTICES'] |
| 12 | 12 | Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR'].to_i == 0 |
| 13 | 13 | Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME'].to_i == 1 |
| 14 | - Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'].to_i == 0 | |
| 15 | 14 | Errbit::Config.enforce_ssl = ENV['ERRBIT_ENFORCE_SSL'] |
| 16 | 15 | |
| 17 | 16 | Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] | ... | ... |
config/cloud/cloud66/files/config.yml
| ... | ... | @@ -32,11 +32,6 @@ confirm_resolve_err: true |
| 32 | 32 | # Helpful when you need to plug in a custom authentication strategy, such as LDAP. |
| 33 | 33 | user_has_username: false |
| 34 | 34 | |
| 35 | -# Allow comments while an issue tracker is configured. | |
| 36 | -# This is useful if the err is not critical enough to create a ticket, | |
| 37 | -# but you want to leave a short comment. | |
| 38 | -allow_comments_with_issue_tracker: true | |
| 39 | - | |
| 40 | 35 | # Display internal errors in production |
| 41 | 36 | # Since this is an internal application, you might like to see what caused Errbit to crash. |
| 42 | 37 | # Pull requests are always welcome! |
| ... | ... | @@ -44,7 +39,6 @@ allow_comments_with_issue_tracker: true |
| 44 | 39 | display_internal_errors: true |
| 45 | 40 | # The host of your errbit server |
| 46 | 41 | |
| 47 | -allow_comments_with_issue_tracker: true | |
| 48 | 42 | # Enable Gravatar. |
| 49 | 43 | use_gravatar: true |
| 50 | 44 | # Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro. | ... | ... |
config/config.example.yml
| ... | ... | @@ -51,11 +51,6 @@ confirm_err_actions: true |
| 51 | 51 | # Helpful when you need to plug in a custom authentication strategy, such as LDAP. |
| 52 | 52 | user_has_username: false |
| 53 | 53 | |
| 54 | -# Allow comments while an issue tracker is configured. | |
| 55 | -# This is useful if the err is not critical enough to create a ticket, | |
| 56 | -# but you want to leave a short comment. | |
| 57 | -allow_comments_with_issue_tracker: true | |
| 58 | - | |
| 59 | 54 | # Display internal errors in production |
| 60 | 55 | # Since this is an internal application, you might like to see what caused Errbit to crash. |
| 61 | 56 | # Pull requests are always welcome! | ... | ... |
config/initializers/_load_config.rb
| ... | ... | @@ -18,9 +18,7 @@ unless defined?(Errbit::Config) |
| 18 | 18 | # Errbit::Config.email_at_notices = ENV['ERRBIT_EMAIL_AT_NOTICES'] |
| 19 | 19 | Errbit::Config.confirm_err_actions = ENV['ERRBIT_CONFIRM_ERR_ACTIONS'].to_i == 0 |
| 20 | 20 | Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME'].to_i == 1 |
| 21 | - Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'].to_i == 0 | |
| 22 | 21 | Errbit::Config.enforce_ssl = ENV['ERRBIT_ENFORCE_SSL'] |
| 23 | - | |
| 24 | 22 | Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] |
| 25 | 23 | Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT'] |
| 26 | 24 | ... | ... |
spec/models/app_spec.rb
| ... | ... | @@ -220,26 +220,4 @@ describe App do |
| 220 | 220 | }.to raise_error(Mongoid::Errors::DocumentNotFound) |
| 221 | 221 | end |
| 222 | 222 | end |
| 223 | - | |
| 224 | - describe "#comments_allowed?" do | |
| 225 | - context "without issue_tracker" do | |
| 226 | - it 'return true' do | |
| 227 | - expect(App.new.comments_allowed?).to be_true | |
| 228 | - end | |
| 229 | - end | |
| 230 | - | |
| 231 | - context "with issue_tracker" do | |
| 232 | - let(:issue_tracker) do | |
| 233 | - ist = IssueTracker.new | |
| 234 | - ist.stub(:comments_allowed?).and_return('foo') | |
| 235 | - ist | |
| 236 | - end | |
| 237 | - it 'delegate to issue_tracker' do | |
| 238 | - expect(App.new( | |
| 239 | - :issue_tracker => issue_tracker | |
| 240 | - ).comments_allowed?).to eql 'foo' | |
| 241 | - end | |
| 242 | - end | |
| 243 | - end | |
| 244 | - | |
| 245 | 223 | end | ... | ... |
spec/views/problems/show.html.haml_spec.rb
| ... | ... | @@ -8,7 +8,6 @@ describe "problems/show.html.haml" do |
| 8 | 8 | def self.label; 'pivotal'; end |
| 9 | 9 | def initialize(app, params); end |
| 10 | 10 | def configured?; true; end |
| 11 | - def comments_allowed?; false; end | |
| 12 | 11 | end |
| 13 | 12 | } |
| 14 | 13 | let(:github_tracker) { |
| ... | ... | @@ -16,7 +15,6 @@ describe "problems/show.html.haml" do |
| 16 | 15 | def initialize(app, params); end |
| 17 | 16 | def label; 'github'; end |
| 18 | 17 | def configured?; true; end |
| 19 | - def comments_allowed?; false; end | |
| 20 | 18 | end |
| 21 | 19 | } |
| 22 | 20 | let(:trackers) { |
| ... | ... | @@ -168,18 +166,16 @@ describe "problems/show.html.haml" do |
| 168 | 166 | end |
| 169 | 167 | end |
| 170 | 168 | end |
| 171 | - | |
| 172 | 169 | end |
| 173 | 170 | end |
| 174 | 171 | end |
| 175 | 172 | |
| 176 | - describe "content_for :comments with comments disabled for configured issue tracker" do | |
| 173 | + describe "content_for :comments" do | |
| 177 | 174 | before do |
| 178 | - Errbit::Config.stub(:allow_comments_with_issue_tracker).and_return(false) | |
| 179 | 175 | Errbit::Config.stub(:use_gravatar).and_return(true) |
| 180 | 176 | end |
| 181 | 177 | |
| 182 | - it 'should display comments and new comment form when no issue tracker' do | |
| 178 | + it 'should display comments and new comment form' do | |
| 183 | 179 | problem = Fabricate(:problem_with_comments) |
| 184 | 180 | view.stub(:problem).and_return(problem) |
| 185 | 181 | view.stub(:app).and_return(problem.app) |
| ... | ... | @@ -190,24 +186,14 @@ describe "problems/show.html.haml" do |
| 190 | 186 | expect(view.content_for(:comments)).to include('Add a comment') |
| 191 | 187 | end |
| 192 | 188 | |
| 193 | - context "with issue tracker" do | |
| 194 | - it 'should not display the comments section' do | |
| 195 | - problem = Fabricate(:problem) | |
| 196 | - with_issue_tracker("pivotal", problem) | |
| 197 | - render | |
| 198 | - expect(view.view_flow.get(:comments)).to be_blank | |
| 199 | - end | |
| 200 | - | |
| 201 | - it 'should display existing comments' do | |
| 202 | - problem = Fabricate(:problem_with_comments) | |
| 203 | - problem.reload | |
| 204 | - with_issue_tracker("pivotal", problem) | |
| 205 | - render | |
| 189 | + it 'should display existing comments' do | |
| 190 | + problem = Fabricate(:problem_with_comments) | |
| 191 | + problem.reload | |
| 192 | + with_issue_tracker("pivotal", problem) | |
| 193 | + render | |
| 206 | 194 | |
| 207 | - expect(view.content_for(:comments)).to include('Test comment') | |
| 208 | - expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') | |
| 209 | - expect(view.content_for(:comments)).to_not include('Add a comment') | |
| 210 | - end | |
| 195 | + expect(view.content_for(:comments)).to include('Test comment') | |
| 196 | + expect(view.content_for(:comments)).to have_selector('img[src^="http://www.gravatar.com/avatar"]') | |
| 211 | 197 | end |
| 212 | 198 | end |
| 213 | 199 | end | ... | ... |