Merge branch 'release/12.2' into dev

pull/11089/head
ulferts 2 years ago
commit 6f0442b3ca
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 1
      app/services/work_packages/update_service.rb
  2. 2
      frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter.component.ts
  3. 1
      frontend/src/global_styles/content/_project_list_modal.sass
  4. 5
      lib/api/v3/utilities/path_helper.rb
  5. 10
      modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb
  6. 27
      modules/costs/spec/lib/api/v3/time_entries/schemas/time_entry_schema_representer_spec.rb
  7. 46
      spec/services/work_packages/update_service_integration_spec.rb

@ -51,7 +51,6 @@ class WorkPackages::UpdateService < ::BaseServices::Update
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

@ -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,

@ -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

@ -519,11 +519,6 @@ module API
"#{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,

@ -103,10 +103,12 @@ module API
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

@ -238,6 +238,33 @@ describe ::API::V3::TimeEntries::Schemas::TimeEntrySchemaRepresenter do
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

@ -901,6 +901,52 @@ describe WorkPackages::UpdateService, 'integration tests', type: :model, with_ma
# 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
{

Loading…
Cancel
Save