Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#46150] readd initialisation to attachable mixin

Eric Schubertc65b68dc8d6c
diff --git a/frontend/src/app/core/config/configuration.service.ts b/frontend/src/app/core/config/configuration.service.ts
index 1afdc83819f..d0d9051808d 100644
--- a/frontend/src/app/core/config/configuration.service.ts
+++ b/frontend/src/app/core/config/configuration.service.ts
@@ -125,8 +125,6 @@ export class ConfigurationService {
.get()
.toPromise()
.then((configuration) => {
- console.warn('set configuration');
- console.warn(new Date().toISOString());
this.configuration = configuration;
});
}
diff --git a/frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts b/frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts
index 9c235c83d6a..136e3adb3ac 100644
--- a/frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts
+++ b/frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts
@@ -60,5 +60,18 @@ export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
const match = this.attachments.elements.find((res:HalResource) => res.name === file);
return !match ? null : (match.staticDownloadLocation as HalLink)?.href;
}
+
+ public $initialize(source:unknown) {
+ super.$initialize(source);
+
+ const attachments = this.attachments || { $source: {}, elements: [] };
+ this.attachments = new AttachmentCollectionResource(
+ this.injector,
+ attachments,
+ false,
+ this.halInitializer,
+ 'HalResource',
+ );
+ }
};
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.spec.ts b/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.spec.ts
index 2326601bb44..1b08857819b 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.spec.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.spec.ts
@@ -52,10 +52,13 @@ function setupMocks(paginationService:PaginationService) {
optionsTruncationSize: 6,
};
+ // eslint-disable-next-line jasmine/no-unsafe-spy
spyOn(paginationService, 'getMaxVisiblePageOptions').and.callFake(() => options.maxVisiblePageOptions);
+ // eslint-disable-next-line jasmine/no-unsafe-spy
spyOn(paginationService, 'getOptionsTruncationSize').and.callFake(() => options.optionsTruncationSize);
+ // eslint-disable-next-line jasmine/no-unsafe-spy
spyOn(paginationService, 'getPaginationOptions').and.callFake(() => options);
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.ts b/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.ts
index 150312c2d29..5026b97763b 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/table-pagination/wp-table-pagination.component.ts
@@ -68,7 +68,7 @@ export class WorkPackageTablePaginationComponent extends TablePaginationComponen
}
ngOnInit() {
- this.perPageOptions = this.paginationService.getPerPageOptions();
+ super.ngOnInit();
this.wpTablePagination
.live$()
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index 44c62f5c03f..7c56f6be28c 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -92,25 +92,14 @@ RSpec.describe 'Work package timeline date formatting',
describe 'with default settings',
with_settings: { start_of_week: '', first_week_of_year: '' } do
- context 'with english locale user' do
- let(:current_user) { create(:admin, language: 'en') }
-
- it 'shows english ISO dates' do
- # expect moment to return week 01 for start date
- expect_date_week work_package.start_date.iso8601, '01'
- expect_date_week work_package.due_date.iso8601, '01'
- # Monday, 4th of january is the second week
- expect_date_week '2021-01-04', '02'
- end
+ before do
+ wp_timeline.expect_timeline!
end
context 'with german locale user' do
let(:current_user) { create(:admin, language: 'de') }
it 'shows german ISO dates' do
- expect(page).to have_selector('.wp-timeline--header-element', text: '52')
- expect(page).to have_selector('.wp-timeline--header-element', text: '53')
-
# expect moment to return week 53 for start date
expect_date_week work_package.start_date.iso8601, '53'
expect_date_week work_package.due_date.iso8601, '53'
@@ -119,6 +108,18 @@ RSpec.describe 'Work package timeline date formatting',
end
end
+ context 'with english locale user' do
+ let(:current_user) { create(:admin, language: 'en') }
+
+ it 'shows english ISO dates' do
+ # expect moment to return week 01 for start date
+ expect_date_week work_package.start_date.iso8601, '01'
+ expect_date_week work_package.due_date.iso8601, '01'
+ # Monday, 4th of january is the second week
+ expect_date_week '2021-01-04', '02'
+ end
+ end
+
context 'with weekdays defined' do
let(:current_user) { create(:admin, language: 'en') }