Commit 6421d7c4 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '217882-allow-designs-to-be-added-to-moved-issues' into 'master'

Allow designs to be mutated when issue is moved/locked

See merge request gitlab-org/gitlab!42935
parents 14612d2e 04dce8d8
......@@ -15,9 +15,6 @@ class IssuePolicy < IssuablePolicy
desc "Issue is confidential"
condition(:confidential, scope: :subject) { @subject.confidential? }
desc "Issue has moved"
condition(:moved) { @subject.moved? }
rule { confidential & ~can_read_confidential }.policy do
prevent(*create_read_update_admin_destroy(:issue))
prevent :read_issue_iid
......@@ -38,12 +35,6 @@ class IssuePolicy < IssuablePolicy
rule { ~can?(:read_design) }.policy do
prevent :move_design
end
rule { locked | moved }.policy do
prevent :create_design
prevent :move_design
prevent :destroy_design
end
end
IssuePolicy.prepend_if_ee('EE::IssuePolicy')
---
title: Allow designs to be added, changed, or destroyed on locked and moved issues
merge_request: 42935
author:
type: changed
......@@ -114,9 +114,6 @@ Designs with the same filename as an existing uploaded design will create a new
of the design, and will replace the previous version. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34353) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.9, dropping a design on an existing uploaded design will also create a new version,
provided the filenames are the same.
Designs cannot be added if the issue has been moved, or its
[discussion is locked](../../discussions/#lock-discussions).
### Skipped designs
Designs with the same filename as an existing uploaded design _and_ whose content has not changed will be skipped.
......
......@@ -160,20 +160,6 @@ RSpec.describe DesignManagement::DesignPolicy do
end
end
context "when the issue is locked" do
let_it_be(:issue) { create(:issue, :locked, project: project) }
let(:current_user) { owner }
it_behaves_like "read-only design abilities"
end
context "when the issue has moved" do
let_it_be(:issue) { create(:issue, project: project, moved_to: create(:issue)) }
let(:current_user) { owner }
it_behaves_like "read-only design abilities"
end
context "when the project is archived" do
let_it_be(:project) { create(:project, :public, :archived) }
let_it_be(:issue) { create(:issue, project: project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment