Ilogeek/redmine_issue_dynamic_edit

If description disabled in tracker, user could not change state from "new state"

koledas opened this issue · 4 comments

If description disabled in tracker, user could not change state from "new state" by dynamic edit.
From standart edit it changed.
This fix solves the problem.
From: requiredAttributes = issue.required_attribute_names(User.current)
To: requiredAttributes = issue.required_attribute_names(User.current) & issue.safe_attribute_names(User.current)

Hi @koledas

I don't get why adding optional field into requiredAttributes var resolve the issue.
Adding attributes user can edit to "requiredAttributes" var doesn't sound good to me.
By doing that, you'll set all the attributes user can edit as required attribute even if they're optional.

You may have a problem with this condition which display or not the current issue status : https://github.com/Ilogeek/redmine_issue_dynamic_edit/blob/master/lib/details_issue_hooks.rb#L55-L60

  • Does the user have access to change the issue status (L57) ?
  • Is the status defined as readonly value by Redmine Admin (L58) ?
  • Are all required fields already filled (such as description) (L59) ?

The last one is maybe the one that block you. What happens if you remove this condition ?

I have already modeled this behavior. Its blocked on L59. If comment L59 user can edit issue status dynamicaly.
issue.required_attribute_names(User.current) & issue.safe_attribute_names(User.current) - this is the intersection (not a union) of the sets of required attributes and those that the user can edit. We get the required attributes available to the user.

  • Does the user have access to change the issue status (L57) ? - Yes, user have access.
  • Is the status defined as readonly value by Redmine Admin (L58) ? - No. User have write access.
  • Are all required fields already filled (such as description) (L59) ? - requiredAttributes = [description, start-date, due-date], allRequiredFieldsFilled=False, start-date and due-date filled, description disabled in tracker.

Hi @koledas

Thank you for the complete feedback and explanations. My bad I haven't correctly read the modification (and unfortunately Ruby is not my main programmation language)

I'll merge your PRs, thank you a lot for the other modification regarding IE issues 👍

Thank you for this cool plugin!