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

Refactor code a bit.

Pavel Balashov5554d949c342
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html
index 860f16cf3a7..54db675b49a 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html
@@ -1,7 +1,7 @@
<div class="spot-list--item-floating-wrapper op-file-list--item-floating-wrapper">
<a
class="spot-list--item-action spot-list--item-action_link op-file-list--item-action"
- [href]="linkHref"
+ [href]="attachment._links.originOpen?.href || attachment._links.staticDownloadLocation.href"
target="_blank"
(dragstart)="setDragData($event)"
>
@@ -31,15 +31,15 @@
class="spot-list--item-floating-actions op-file-list--item-floating-actions hidden-for-mobile"
>
<a
- *ngIf="!!this.attachment._links.originOpen"
+ *ngIf="!!attachment._links.originOpen"
class="spot-link"
- [href]="this.attachment._links.staticDownloadLocation.href"
+ [href]="attachment._links.staticDownloadLocation.href"
target="_blank"
>
<span class="spot-icon spot-icon_download-arrow"></span>
</a>
<button
- *ngIf="!!this.attachment._links.delete"
+ *ngIf="!!attachment._links.delete"
type="button"
class="spot-link"
[title]="deleteIconTitle"
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts
index 601a1979066..87fc992c956 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts
@@ -167,13 +167,6 @@ export class OpAttachmentListItemComponent extends UntilDestroyedMixin implement
return el;
}
- public get linkHref():string {
- if (this.attachment._links.originOpen !== undefined) {
- return this.attachment._links.originOpen.href;
- }
- return this.attachment._links.staticDownloadLocation.href;
- }
-
private get downloadPath():string {
return this.pathHelper.attachmentDownloadPath(String(this.attachment.id), this.attachment.fileName);
}