Project

General

Profile

Actions

Defect #40860

closed

Creating a new issue fails with an internal error if no issue priorities are defined

Added by Holger Just 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

If no issue priority is defined, creating an issue using issue#create fails with the following error:

NoMethodError (undefined method `id' for nil:NilClass):

app/models/issue.rb:2075:in `clear_disabled_fields'
app/controllers/issues_controller.rb:153:in `create'
lib/redmine/sudo_mode.rb:78:in `sudo_mode'

This can be fixed with the attached patch which results in a proper error message to be shown to the user:

Priority cannot be blank

Unfortunately, this message is still shown even if the priority field is disabled for a tracker (as we still have to set a priority here, see #38416).

This may be acceptable as a uncommon special case though. If this shall be changed, we might handle this similar to the check for a defined tracker and default status in IssueController#build_new_issue_from_params.


Files

issue_priorities.diff (514 Bytes) issue_priorities.diff Holger Just, 2024-06-19 18:17
test-for-40860.patch (751 Bytes) test-for-40860.patch Go MAEDA, 2024-06-20 13:39

Related issues

Related to Redmine - Feature #38416: Ability to disable the priority fieldClosedGo MAEDA

Actions
Actions #1

Updated by Holger Just 5 months ago

See Internal error after hitting issue create button (redmine... for the original description of this issue.

Actions #2

Updated by Go MAEDA 5 months ago

  • Target version changed from Candidate for next minor release to 5.0.10
Actions #3

Updated by Go MAEDA 5 months ago

  • Related to Feature #38416: Ability to disable the priority field added
Actions #4

Updated by Go MAEDA 5 months ago

I wrote a test for the fix.

Actions #5

Updated by Go MAEDA 5 months ago

  • Subject changed from Creating a new issue fails with an internal eror if no issue priorities are defined to Creating a new issue fails with an internal error if no issue priorities are defined
  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r22895. Thank you.

Actions #6

Updated by Go MAEDA 4 months ago

  • Status changed from Resolved to Closed

Merged the fix into 5.1-stable in r22900.

Actions #7

Updated by Holger Just 4 months ago

Thank you!

Actions

Also available in: Atom PDF