woblavobla / redmine_custom_reminder

Simple redmine plugin for scheduled email sending;
Apache License 2.0
8 stars 12 forks source link

Internal error 500 #14

Open drkamine opened 5 years ago

drkamine commented 5 years ago

Hello , i just install redmine Custom redminer accroding this link
https://www.redmine.org/plugins/redmine_custom_reminder but i get this error 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

i tested it in redmine 4.0.4 and 4.0.0 same issue

woblavobla commented 5 years ago

Hi there. @drkamine, did you followed all steps listed in instruction?

drkamine commented 5 years ago

yes, sir

woblavobla commented 5 years ago

@drkamine, could you provide some logs?

drkamine commented 5 years ago

App 17172 stderr: 30: <% if reminder.active? %> App 17172 stderr: 31: App 17172 stderr:
App 17172 stderr: plugins/redmine_custom_reminder/app/models/custom_reminder.rb:14:in map' App 17172 stderr: plugins/redmine_custom_reminder/app/models/custom_reminder.rb:14:innotification_recipient_names' App 17172 stderr: plugins/redmine_custom_reminder/app/models/custom_reminder.rb:28:in notification_recipient_name' App 17172 stderr: plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:28:inblock in _plugins_redmine_custom_reminder_app_views_custom_reminders_index_html_erb_1991654587914166384_47047731218340' App 17172 stderr: plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:24:in each' App 17172 stderr: plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:24:in_plugins_redmine_custom_reminder_app_views_custom_reminders_index_htmlerb1991654587914166384_47047731218340' App 17172 stderr: lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Mant1kor commented 5 years ago

@woblavobla I've got the same error. In log file:

Started GET "/custom_reminders" for 10.1.1.100 at 2019-10-29 16:42:18 +0200
Processing by CustomRemindersController#index as HTML
  Current user: admin (id=1)
  Rendering plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb within layouts/admin
  Rendered plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb within layouts/admin (2.1ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 1.8ms)

ActionView::Template::Error (can't cast Class):
    25:         <tr class="<%= cycle("odd", "even") %> <%= 'disabled' unless reminder.active? %>">
    26:           <td class="name"><%= link_to reminder.name, edit_custom_reminder_path(reminder) %></td>
    27:           <td class="description"><%= reminder.description %></td>
    28:           <td class="notification_recipient"><%= CustomReminder.notification_recipient_name(reminder.notification_recipient) %></td>
    29:           <td class="active">
    30:             <% if reminder.active? %>
    31:               <span class="icon icon-ok"></span>

plugins/redmine_custom_reminder/app/models/custom_reminder.rb:14:in `map'
plugins/redmine_custom_reminder/app/models/custom_reminder.rb:14:in `notification_recipient_names'
plugins/redmine_custom_reminder/app/models/custom_reminder.rb:28:in `notification_recipient_name'
plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:28:in `block in _plugins_redmine_custom_reminder_app_views_custom_reminders_index_html_erb___3838880580462844626_69824302045060'
plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:24:in `each'
plugins/redmine_custom_reminder/app/views/custom_reminders/index.html.erb:24:in `_plugins_redmine_custom_reminder_app_views_custom_reminders_index_html_erb___3838880580462844626_69824302045060'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Env:

Environment:
  Redmine version                4.0.4.stable
  Ruby version                   2.6.3-p62 (2019-04-16) [x86_64-linux]
  Rails version                  5.2.3
  Environment                    production
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  redmine_contacts               4.2.5
  redmine_custom_reminder        0.7.2.3d6abc6
  redmine_email_fetcher          1.0.0
  redmine_lightbox2              0.5.0
vongola12324 commented 4 years ago

I've got the same error as @Mant1kor, and I'm using redmine 4.0.5.

It seems the error is triggled at app/views/custom_reminders/index.html.erb:28.

<td class="notification_recipient"><%= CustomReminder.notification_recipient_name(reminder.notification_recipient) %></td>

In app/models/custom_reminder.rb:14

@recipients ||= CustomField.where(type: [IssueCustomField, ProjectCustomField], field_format: 'user').map { |r| [r.name, r.id] } 

The problem is that the IssueCustomField and ProjectCustomField here refer to the class. It seems that ruby can't convert them into strings.

I'm not sure if this solution is correct, but after I put the quotation marks, it worked properly.

@recipients ||= CustomField.where(type: ['IssueCustomField', 'ProjectCustomField'], field_format: 'user').map { |r| [r.name, r.id] }