Redmine-Periodic-Task icon indicating copy to clipboard operation
Redmine-Periodic-Task copied to clipboard

The plugin does not check, if the project still exists

Open s-andy opened this issue 8 years ago • 1 comments

When a project with periodic task is removed, its tasks are not. This causes crash of the rake task at the line:

https://github.com/jperelli/Redmine-Periodic-Task/blob/7c52e0c153c06ab5277b8211cc238f9afe31507a/lib/scheduled_tasks_checker.rb#L34

Here, #save executes validations and validations attempt to access the project, which does not exist any longer. The exact error message is:

rake aborted!
NoMethodError: undefined method `assignable_users' for nil:NilClass
/opt/bitnami/apps/redmine/htdocs/app/models/issue.rb:928:in `assignable_users'
/opt/bitnami/apps/redmine/htdocs/app/models/issue.rb:729:in `validate_issue'
/opt/bitnami/apps/redmine/htdocs/plugins/periodictask/lib/scheduled_tasks_checker.rb:34:in `block in checktasks!'
/opt/bitnami/apps/redmine/htdocs/plugins/periodictask/lib/scheduled_tasks_checker.rb:4:in `checktasks!'
/opt/bitnami/apps/redmine/htdocs/plugins/periodictask/lib/tasks/periodictask.rake:11:in `block (2 levels) in <top (required)>'
Tasks: TOP => redmine:check_periodictasks
(See full trace by running task with --trace)

I believe, the plugin should be fixed, so that periodic tasks are removed with the project.

s-andy avatar Jan 16 '18 20:01 s-andy

Great catch! If you make a pull request, I'll be happy to merge it!

jperelli avatar Jan 31 '18 00:01 jperelli