Vote #77968
完了Project field disappears when target project disallows user to edit the project
0%
説明
h1. Issue
Editing the Project Field in an Issue reloads the form¶
On Reloading / Rendering the project field is excluded if the user is not allowed to change the @project_id@ for issues in that project¶
The field disappears when the user clicks on a project where changing the project field is not allowed¶
The issue cannot be moved to the other project by that user, however: The list of target projects is calculated by the right to create issues in that project. This means that there is a mismatch.¶
h1. Goal
The project field should not disappear on selection of a project, either by showing the field more often (lax approach) or reducing the target projects list.
h1. Suggestion
My suggestion for the lax approach is:
# app/views/issues/_form.html.erb
- <% if @issue.safe_attribute?('project_id') && (!@issue.new_record? || @project.nil? || @issue.copy?) %>
+ <% if (@issue.safe_attribute?('project_id') || @issue.allowed_target_projects.include?(@issue.project_id) ) && (!@issue.new_record? || @project.nil? || @issue.copy?) %>
<%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true},
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %>
<% end %>
journals
--------------------------------------------------------------------------------
Fixed in r15959 using a slightly different solution and tests added.
Thanks for pointing this out.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------