arkhitech / redmine_mentions

Allows users to mention team members in their notes/comments.
MIT License
94 stars 88 forks source link

Redmine got 500 error after installed this plugin #21

Open rikki opened 9 years ago

rikki commented 9 years ago

Internal error

An error occurred on the page you were trying to access. If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

The log shows that a method called "delete_if" is not been claimed

Started GET "/issues/5" for 111.193.182.23 at 2014-12-15 18:50:50 +0800 Processing by IssuesController#show as HTML Parameters: {"id"=>"5"} Current user: zhichao.lv (id=1) Rendered issues/_action_menu.html.erb (2.7ms) Rendered issue_relations/_form.html.erb (1.4ms) Rendered issues/_relations.html.erb (2.2ms) Rendered issues/_history.html.erb (24.4ms) Rendered issues/_action_menu.html.erb (1.8ms) Rendered issues/_form_custom_fields.html.erb (0.1ms) Rendered issues/_attributes.html.erb (11.6ms) Rendered plugins/redmine_mentions/app/views/hooks/redmine_mentions/_edit_mentionable.html.erb (3.9ms) Rendered issues/_form.html.erb (26.0ms) Rendered issues/_edit.html.erb (26.7ms) Rendered issues/show.html.erb within layouts/base (75.3ms) Completed 500 Internal Server Error in 132ms

ActionView::Template::Error (undefined method delete_if' for #<User::ActiveRecord_Relation:0x00000007780828>): 4: <% regex_find = '/\B'+Setting.plugin_redmine_mentions['trigger']+'(\w*)$/i'%> 5: 6: 7: <%users= @project.users.delete_if{|u| (u.type != 'User' || u.mail.empty?)}%> 8: <%users_regex=users.collect{|u| "#{Setting.plugin_redmine_mentions['trigger']}#{u.login}"}.join('|')%> 9: <% regex_highlight = '/\B('+users_regex+')/g' %> 10: <script> lib/redmine/hook.rb:119:inblock (2 levels) in render_on' lib/redmine/hook.rb:117:in map' lib/redmine/hook.rb:117:inblock in render_on' lib/redmine/hook.rb:61:in block (2 levels) in call_hook' lib/redmine/hook.rb:61:ineach' lib/redmine/hook.rb:61:in block in call_hook' lib/redmine/hook.rb:58:intap' lib/redmine/hook.rb:58:in call_hook' lib/redmine/hook.rb:167:incall_hook' app/views/issues/_form.html.erb:44:in block in _app_views_issues__form_html_erb___1797317687149565551_74475560' app/helpers/application_helper.rb:1023:inlabelled_fields_for' app/views/issues/_form.html.erb:1:in _app_views_issues__form_html_erb___1797317687149565551_74475560' app/views/issues/_edit.html.erb:8:inblock in _app_views_issuesedit_html_erb972739190247922089_74614380' app/helpers/application_helper.rb:1016:in labelled_form_for' app/views/issues/_edit.html.erb:1:in_app_views_issuesedit_html_erb972739190247922089_74614380' app/views/issues/show.html.erb:132:in _app_views_issues_show_html_erb__17552338068304259_77461980' app/controllers/issues_controller.rb:128:inblock (2 levels) in show' app/controllers/issues_controller.rb:125:in `show'

And redmine info is here: Environment: Redmine version 2.6.0.devel Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux] Rails version 4.1.8 Environment production Database adapter Mysql2 SCM: Git 1.7.10.4 Filesystem
Redmine plugins: redmine_mentions 0.0.1

galexrt commented 9 years ago

I'm getting the same error as @rikki I'm using the same version of redmine and ruby as him

Processing by IssuesController#new as HTML
  Parameters: {"project_id"=>"iito-hso-mgmt-dm"}
  Current user: Galexrt (id=3)
  Rendered issues/_form_custom_fields.html.erb (4.4ms)
  Rendered issues/_attributes.html.erb (21.8ms)
  Rendered plugins/redmine_mentions/app/views/hooks/redmine_mentions/_edit_mentionable.html.erb (3.3ms)
  Rendered issues/_form.html.erb (36.6ms)
  Rendered issues/new.html.erb within layouts/base (38.0ms)
Completed 500 Internal Server Error in 66ms

ActionView::Template::Error (undefined method `delete_if' for #<User::ActiveRecord_Relation:0x007f9318039550>):
    4: <% regex_find = '/\B'+Setting.plugin_redmine_mentions['trigger']+'(\w*)$/i'%>
    5:
    6:
    7: <%users= @project.users.delete_if{|u| (u.type != 'User' || u.mail.empty?)}%>
    8: <%users_regex=users.collect{|u| "#{Setting.plugin_redmine_mentions['trigger']}#{u.login}"}.join('|')%>
    9: <% regex_highlight = '/\B('+users_regex+')/g' %>
   10: <script>
  lib/redmine/hook.rb:120:in `block (2 levels) in render_on'
  lib/redmine/hook.rb:118:in `map'
  lib/redmine/hook.rb:118:in `block in render_on'
  lib/redmine/hook.rb:62:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:62:in `each'
  lib/redmine/hook.rb:62:in `block in call_hook'
  lib/redmine/hook.rb:59:in `tap'
  lib/redmine/hook.rb:59:in `call_hook'
  lib/redmine/hook.rb:168:in `call_hook'
  app/views/issues/_form.html.erb:44:in `block in _app_views_issues__form_html_erb__1231411727637894253_70134883614000'
  app/helpers/application_helper.rb:1024:in `labelled_fields_for'
  app/views/issues/_form.html.erb:1:in `_app_views_issues__form_html_erb__1231411727637894253_70134883614000'
  app/views/issues/new.html.erb:11:in `block in _app_views_issues_new_html_erb__2465577942882988662_70134881425360'
  app/helpers/application_helper.rb:1017:in `labelled_form_for'
  app/views/issues/new.html.erb:5:in `_app_views_issues_new_html_erb__2465577942882988662_70134881425360'
  app/controllers/issues_controller.rb:144:in `block (2 levels) in new'
  app/controllers/issues_controller.rb:143:in `new'

For now I deactivated the plugin to being able to create issues, but I hope this being fixed fast. :smiley:

zohar commented 9 years ago

Same error here. redmine 2.2.1

Note the errors at the end:

Started PUT "//issues/38402" for 33.41.33.41 at Mon Aug 03 13:45:58 +0300 2015
Processing by IssuesController#update as HTML
  Parameters: {"issue"=>{"parent_issue_id"=>"", "done_ratio"=>"0", "priority_id"=>"4", "start_date"=>"2015-08-03 00:00:00", "notes"=>"Looking in logs (@username )", "assigned_to_id"=>"", "tracker_id"=>"4", "description"=>"@otheruser did you receive any mail/notification?", "fixed_version_id"=>"", "private_notes"=>"0", "subject"=>"Testing mentions", "lock_version"=>"3", "is_private"=>"0", "status_id"=>"1", "due_date"=>"", "estimated_hours"=>"", "project_id"=>"00000"}, "commit"=>"Submit", "time_entry"=>{"comments"=>"", "hours"=>"", "activity_id"=>"9"}, "utf8"=>"✓", "attachments"=>{"1"=>{"description"=>""}}, "id"=>"38402", "last_journal_id"=>"94418", "authenticity_token"=>"xxxxxxx"}
  Current user: username (id=4)
Completed 500 Internal Server Error in 416ms

SyntaxError (/usr/local/redmine-2.2.1/plugins/redmine_mentions/app/models/mention_mailer.rb:3: syntax error, unexpected ':', expecting kEND
  default from: Setting.mail_from
               ^
/usr/local/redmine-2.2.1/plugins/redmine_mentions/app/models/mention_mailer.rb:12: syntax error, unexpected ':', expecting ')'
    mail(to: user.mail, subject: "[#{@issu...
            ^
/usr/local/redmine-2.2.1/plugins/redmine_mentions/app/models/mention_mailer.rb:12: syntax error, unexpected ':', expecting '='
...  mail(to: user.mail, subject: "[#{@issue.tracker.name} ##{@...
                              ^
/usr/local/redmine-2.2.1/plugins/redmine_mentions/app/models/mention_mailer.rb:12: syntax error, unexpected ')', expecting kEND):
  app/models/journal.rb:52:in `save'
  app/models/issue.rb:1362:in `create_journal'
  app/models/issue.rb:965:in `save_issue_with_child_records'
  app/models/issue.rb:952:in `save_issue_with_child_records'
  app/controllers/issues_controller.rb:176:in `update'