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

Improve code readability

Wieland Lindenthal972ab9363ac0
diff --git a/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts b/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
index 1d82ed8366f..7616c5b7605 100644
--- a/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
+++ b/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
@@ -34,10 +34,11 @@ export class BcfThumbnailDisplayField extends DisplayField {
@InjectField() bcfPathHelper:BcfPathHelperService;
public render(element:HTMLElement, displayText:string):void {
- if (_.get(this, 'resource.bcfViewpoints[0]')) {
- let vp = this.resource.bcfViewpoints[0];
+ const viewpoints = this.resource.bcfViewpoints;
+ if (viewpoints && viewpoints.length > 0) {
+ const viewpoint = viewpoints[0];
element.innerHTML = `
- <img src="${this.bcfPathHelper.snapshotPath(vp)}" class="thumbnail">
+ <img src="${this.bcfPathHelper.snapshotPath(viewpoint)}" class="thumbnail">
`;
} else {
element.innerHTML = '';
diff --git a/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
index d5452578bcb..ef96b30911e 100644
--- a/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
+++ b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
@@ -30,7 +30,7 @@ describe 'BCF snapshot column', type: :feature, js: true, with_mail: false do
wp_table.expect_work_package_listed(work_package)
page.within(".wp-row-#{work_package.id} td.bcfThumbnail") do
- image_path = "/api/bcf/2.1/projects/myproject_no_1/topics/#{bcf_issue.uuid}/viewpoints/#{bcf_issue.viewpoints.first.uuid}/snapshot"
+ image_path = "/api/bcf/2.1/projects/#{project.identifier}/topics/#{bcf_issue.uuid}/viewpoints/#{bcf_issue.viewpoints.first.uuid}/snapshot"
expect(page).to have_selector("img[src=\"#{image_path}\"]")
end
end