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

Teach ng AttachmentsComponent allowRemoval input

Alexander Brandon Coles320739d037b2
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 f4950262804..e98706b085e 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
@@ -45,7 +45,7 @@
<span class="spot-icon spot-icon_download-arrow"></span>
</a>
<button
- *ngIf="!!attachment._links.delete"
+ *ngIf="showDelete && !!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 4f825aa3af6..723b82fa696 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
@@ -65,6 +65,8 @@ export class OpAttachmentListItemComponent extends UntilDestroyedMixin implement
@Input() public showTimestamp = true;
+ @Input() public showDelete = true;
+
@Output() public removeAttachment = new EventEmitter<void>();
@ViewChild('avatar') avatar:ElementRef;
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html
index 50f7f59f394..b10e39ae3c4 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html
@@ -9,6 +9,7 @@
data-test-selector="op-attachment-list-item"
[attachment]="attachment"
[showTimestamp]="showTimestamp"
+ [showDelete]="showDelete"
[index]="i"
(removeAttachment)="removeAttachment(attachment)"
></li>
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
index f8cba9b772e..959c31eeda4 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts
@@ -49,6 +49,8 @@ export class OpAttachmentListComponent extends UntilDestroyedMixin {
@Input() public showTimestamp = true;
+ @Input() public showDelete = true;
+
@Output() public attachmentRemoved = new EventEmitter<void>();
constructor(
diff --git a/frontend/src/app/shared/components/attachments/attachments.component.html b/frontend/src/app/shared/components/attachments/attachments.component.html
index 6df36c5761b..9d233ae740a 100644
--- a/frontend/src/app/shared/components/attachments/attachments.component.html
+++ b/frontend/src/app/shared/components/attachments/attachments.component.html
@@ -7,6 +7,7 @@
[attachments]="attachments$ | async"
[collectionKey]="collectionKey"
[showTimestamp]="showTimestamp"
+ [showDelete]="allowRemoval"
(attachmentRemoved)="attachmentRemoved.emit()"
></op-attachment-list>
diff --git a/frontend/src/app/shared/components/attachments/attachments.component.ts b/frontend/src/app/shared/components/attachments/attachments.component.ts
index d4dee4b1430..8054ee68c92 100644
--- a/frontend/src/app/shared/components/attachments/attachments.component.ts
+++ b/frontend/src/app/shared/components/attachments/attachments.component.ts
@@ -76,6 +76,8 @@ export class OpAttachmentsComponent extends UntilDestroyedMixin implements OnIni
@Input() public allowUploading = true;
+ @Input() public allowRemoval = true;
+
@Input() public destroyImmediately = true;
@Input() public externalUploadButton:string|null = null;