Project

General

Profile

Actions

Defect #24311

closed

Project field disappears when target project disallows user to edit the project

Added by Luka Lüdicke about 8 years ago. Updated about 8 years ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Issue

  1. Editing the Project Field in an Issue reloads the form
  2. On Reloading / Rendering the project field is excluded if the user is not allowed to change the project_id for issues in that project
  3. The field disappears when the user clicks on a project where changing the project field is not allowed
  4. 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.

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.

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?) %>
  <p><%= 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)" %></p>
  <% end %>

Files

issues_form.diff (802 Bytes) issues_form.diff lax_approach Luka Lüdicke, 2016-11-11 11:32
Actions #2

Updated by Jean-Philippe Lang about 8 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 3.3.2
  • Resolution set to Fixed

Fixed in r15959 using a slightly different solution and tests added.
Thanks for pointing this out.

Actions #3

Updated by Jean-Philippe Lang about 8 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF