mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
committed by
Tobias Dillmann
parent
f3a69c179c
commit
905b21b31f
@@ -234,16 +234,10 @@ module OpenProject::Backlogs
|
||||
end
|
||||
|
||||
config.to_prepare do
|
||||
%i[position story_points sprint].each do |attribute|
|
||||
%i[position story_points sprint backlog_bucket].each do |attribute|
|
||||
::Type.add_constraint attribute, ->(_type, project: nil) { project.nil? || project.backlogs_enabled? }
|
||||
end
|
||||
|
||||
story_and_sprint_permission = ->(_type, project: nil) do
|
||||
project.nil? || User.current.allowed_in_project?(:view_sprints, project)
|
||||
end
|
||||
|
||||
::Type.add_constraint :backlog_bucket, story_and_sprint_permission
|
||||
|
||||
::Type.add_default_mapping(:estimates_and_progress, :story_points)
|
||||
::Type.add_default_mapping(:other, :position)
|
||||
::Type.add_default_mapping(:details, :sprint)
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do
|
||||
allow(p).to receive(:backlogs_enabled?).and_return(backlogs_enabled)
|
||||
end
|
||||
end
|
||||
let(:work_package_type) { build_stubbed(:type, attribute_groups: [["Agile", %w[position sprint story_points]]]) }
|
||||
let(:work_package_type) { build_stubbed(:type, attribute_groups: [["Agile", %w[position sprint story_points backlog_bucket]]]) }
|
||||
let(:work_package) { build_stubbed(:work_package, type: work_package_type) }
|
||||
|
||||
let(:current_user) { build_stubbed(:user) }
|
||||
@@ -138,7 +138,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do
|
||||
describe "attribute_groups" do
|
||||
context "with backlogs enabled" do
|
||||
it "has backlogs properties listed in the right group" do
|
||||
expect(subject).to be_json_eql(%w[position sprint storyPoints])
|
||||
expect(subject).to be_json_eql(%w[position sprint storyPoints backlogBucket])
|
||||
.at_path("_attributeGroups/0/attributes")
|
||||
end
|
||||
end
|
||||
@@ -147,7 +147,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do
|
||||
let(:permissions) { %i(view_work_packages edit_work_packages) }
|
||||
|
||||
it "has backlogs properties listed in the right group" do
|
||||
expect(subject).to be_json_eql(%w[position sprint storyPoints])
|
||||
expect(subject).to be_json_eql(%w[position sprint storyPoints backlogBucket])
|
||||
.at_path("_attributeGroups/0/attributes")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user