alexbevi / redmine_knowledgebase

A knowledgebase plugin for Redmine
452 stars 199 forks source link

[Error 500] Add a comment without contents #324

Closed chanbuu closed 6 years ago

chanbuu commented 8 years ago

Hi.

I have used this plugin from 1 years ago. The following error is shown When I try to add a comment for an article with empty text. This process should validate the parameter of comment when it is empty If you can.

Started POST "/projects/knowledgebase_sys/knowledgebase/articles/105/add_comment" for 192.168.95.19 at 2016-03-24 20:20:18 +0900
Processing by ArticlesController#add_comment as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"wvaTdRcsxdjMlMtmmx19qoUjXzc7pKki7dhyjPUIMqg=", "comment"=>{"comments"=>""}, "commit"=>"追加", "project_id"=>"knowledgebase_sys", "id"=>"105"}
  Current user: chanbuu (id=12)
  Rendered plugins/redmine_knowledgebase/app/views/categories/_jump_box.html.erb (9.8ms)
  Rendered plugins/redmine_knowledgebase/app/views/likes/_like.html.erb (0.8ms)
  Rendered plugins/redmine_knowledgebase/app/views/articles/sections/_content.html.erb (9.6ms)
  Rendered plugins/redmine_knowledgebase/app/views/articles/sections/_comments.html.erb (5.5ms)
  Rendered common/_tabs.html.erb (18.1ms)
  Rendered plugins/redmine_knowledgebase/app/views/articles/show.html.erb within layouts/base (42.9ms)
Completed 500 Internal Server Error in 64ms

ActionView::Template::Error (undefined method `-' for nil:NilClass):
    2: <% @comments.each do |comment| %>
    3:   <h4>
    4:     <%= avatar(comment.author, :size => "24") %>
    5:     &nbsp;<%= authoring comment.created_on, comment.author %>&nbsp; 
    6:     <%= link_to_if_authorized image_tag('delete.png'), 
    7:          { :controller => 'articles', :action => 'destroy_comment', :id => @article.id, :comment_id => comment.id },
    8:          :confirm => l(:text_are_you_sure), 
  app/helpers/application_helper.rb:371:in `time_tag'
  app/helpers/application_helper.rb:367:in `authoring'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__3317472167904595826_162163400'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__3317472167904595826_162163400'
  app/helpers/application_helper.rb:263:in `render_tabs'
  lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb:556:in `call'
  lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb:556:in `without_locking'
  lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb:424:in `without_locking'

The envelopment of our Redmine is follow.

Environment
  Redmine version                          2.2.0.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.9
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  redmine_knowledgebase                    3.0.4

Please consider that. Best regards and thank you for the plugin.

robspearman commented 6 years ago

This is now fixed.