Tracker status cannot be empty in when processing commit messages
we just recently upgraded to Redmine 4.0.3 and face troubles updating our issues with commit messages. We are using the keyword "for" to mark commits that refer to a certain issue - but do not necessarily cause any change in its state (see configuration.png). Therefore, so far we just left the field "Applied status" empty - with this setting, Redmine linked the commit revision to the referenced ticket, but did not change the status at all. That's exactly the bevhaviour we were looking for.
With Redmine 4.x it seems that the "Applied status" is mandatory. When looking into the log, we find the following message:
Issue #13631 could not be saved by changeset 83317: ["Status cannot be blank"]
When digging the problem, we found the following: Redmine applies the changes in app/models/changeset.rb, method fix_issue:
if rule issue.assign_attributes rule.slice(*Issue.attribute_names) end
The thing is that the rule looks as follows:
- keywords: for status_id: '0'
The '0' for the status id comes from the Redmine configuration area - if you do not select a status, it will use '0'. When assign_attributes is called with this map, the status is set to
nil - causing the problem described above. I checked the Redmine code for 3.x and could not find any changes, so I rather assume that the problem arises from changs to the
assign_attributes (from the Active Record libs).
I think it would be the best to not change the status in app/models/changeset.rb, method fix_issue, if the status_id is '0'. I have to admit I am not too familiar with ruby and rails, but removing the field "status_issue" from the "rule" (only when the status is 0) in the fix_issue Method should do the trick.
I have also filed a forum post with more details here: https://www.redmine.org/boards/1/topics/57210
- Database: MariaDB 10.1.38
- Ruby: 2.5.1
- Rails: 126.96.36.199
- Redmine: 4.0.3
- SVN: 1.9.7