Skip to content

Commit

Permalink
Merge branch 'release/12.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Aug 3, 2022
2 parents d56e7fb + 4006d3c commit 6f0442b
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/services/work_packages/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def update_related_work_packages(service_call)

def update_related(work_package)
consolidated_calls(update_descendants(work_package) + reschedule_related(work_package))
.reject { |dependent_call| dependent_call.result.id == work_package.id }
.each { |dependent_call| dependent_call.result.save(validate: false) }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class UserAutocompleterComponent extends UntilDestroyedMixin implements O

return this
.halResourceService
.get<CollectionResource<UserResource>>(filteredURL.toString())
.get<CollectionResource<UserResource>>(filteredURL.toString(), { pageSize: -1 })
.pipe(
map((res) => res.elements.map((el) => ({
name: el.name, id: el.id, href: el.href, avatar: el.avatar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
@include spot-body-small(normal, italic)
margin: $spot-spacing-1-5 $spot-spacing-1
color: $spot-color-basic-gray-3
flex-grow: 1
5 changes: 0 additions & 5 deletions lib/api/v3/utilities/path_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,6 @@ def self.work_packages_by_project(project_id)
"#{project(project_id)}/work_packages"
end

def self.filtered_path(base_path, *filters)
escaped = CGI.escape(::JSON.dump(filters))
"#{base_path}?filters=#{escaped}"
end

def self.path_for(path, filters: nil, sort_by: nil, group_by: nil, page_size: nil, offset: nil, select: nil)
query_params = {
filters: filters&.to_json,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ def allowed_projects_href
end

def allowed_user_href
api_v3_paths.filtered_path api_v3_paths.principals,
status: { operator: '!', values: [Principal.statuses[:locked].to_s] },
type: { operator: '=', values: ['User'] },
member: { operator: '=', values: [represented.project_id] }
api_v3_paths.path_for :principals,
filters: [
{ status: { operator: '!', values: [Principal.statuses[:locked].to_s] } },
{ type: { operator: '=', values: ['User'] } },
{ member: { operator: '=', values: [represented.project_id] } }
]
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,33 @@
end
end
end

describe 'user' do
let(:path) { 'user' }

it_behaves_like 'has basic schema properties' do
let(:type) { 'User' }
let(:name) { TimeEntry.human_attribute_name('user') }
let(:required) { true }
let(:writable) { true }
let(:location) { '_links' }
end

context 'if embedding' do
let(:embedded) { true }

it_behaves_like 'links to allowed values via collection link' do
let(:href) do
api_v3_paths.path_for :principals,
filters: [
{ status: { operator: '!', values: [Principal.statuses[:locked].to_s] } },
{ type: { operator: '=', values: ['User'] } },
{ member: { operator: '=', values: [project.id] } }
]
end
end
end
end
end

context 'custom value' do
Expand Down
46 changes: 46 additions & 0 deletions spec/services/work_packages/update_service_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,52 @@
# rubocop:enable RSpec/ExampleLength
end

describe 'rescheduling work packages with a parent having a follows relation (Regression #43220)' do
let(:predecessor_work_package_attributes) do
work_package_attributes.merge(
start_date: Time.zone.today + 1.day,
due_date: Time.zone.today + 3.days
)
end

let!(:predecessor_work_package) do
create(:work_package, predecessor_work_package_attributes).tap do |wp|
create(:follows_relation, from: parent_work_package, to: wp)
end
end

let(:parent_work_package) do
create(:work_package, work_package_attributes)
end

let(:expected_parent_dates) do
{
start_date: Time.zone.today + 4.days,
due_date: Time.zone.today + 4.days
}
end

let(:expected_child_dates) do
{
start_date: Time.zone.today + 4.days,
due_date: nil
}
end

let(:attributes) { { parent: parent_work_package } }

it 'sets the parent and child dates correctly' do
expect(subject)
.to be_success

expect(parent_work_package.reload.slice(:start_date, :due_date).symbolize_keys)
.to eq(expected_parent_dates)

expect(work_package.reload.slice(:start_date, :due_date).symbolize_keys)
.to eq(expected_child_dates)
end
end

describe 'changing the parent' do
let(:former_parent_attributes) do
{
Expand Down

0 comments on commit 6f0442b

Please sign in to comment.