From 63eedafb1c3a0994777ee023171ebdd08fab3cc0 Mon Sep 17 00:00:00 2001 From: j-erler Date: Thu, 24 Sep 2026 00:16:13 +0200 Subject: [PATCH] Allowed the attachments dialog to hide the remove button Co-Authored-By: Claude Opus 5.5 --- .../Dialogs/ReviewAttachmentsDialog.razor | 35 +++++++++++++------ .../Dialogs/ReviewAttachmentsDialog.razor.cs | 15 ++++++-- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor index 3528d5fc..8e11ef54 100644 --- a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor +++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor @@ -9,7 +9,14 @@ Disabled="@this.IsZoneDisabled" Context="isDropTarget"> - @T("Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name. You can remove any attachment using the trash can icon.") + @if (this.CanRemove) + { + @T("Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name. You can remove any attachment using the trash can icon.") + } + else + { + @T("Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name.") + } @if (this.CanAttach) @@ -66,11 +73,14 @@ OnClick="@(() => this.InvestigateFile(fileAttachment))"/> - - - + @if (this.CanRemove) + { + + + + } } @@ -93,11 +103,14 @@ Color="Color.Primary" Disabled="true"/> - - - + @if (this.CanRemove) + { + + + + } } diff --git a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs index daccf3c6..1f68c076 100644 --- a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs @@ -38,6 +38,16 @@ public partial class ReviewAttachmentsDialog : MSGComponentBase [Parameter] public Func? IsAttachingUnavailable { get; set; } + /// + /// Whether the user may remove attachments here. + /// + /// + /// False when this dialog gathers the attachments of several messages at once: a removal would + /// reach into a message that was already sent, and nothing here could tell which one. + /// + [Parameter] + public bool CanRemove { get; set; } = true; + [Inject] private IDialogService DialogService { get; set; } = null!; @@ -120,11 +130,12 @@ public partial class ReviewAttachmentsDialog : MSGComponentBase private async Task PathsDropped(List paths) => await this.AttachPathsAsync(paths); - public static async Task> OpenDialogAsync(IDialogService dialogService, HashSet documentPaths, Func, Task>>? attachPaths = null, Func? isAttachingUnavailable = null) + public static async Task> OpenDialogAsync(IDialogService dialogService, HashSet documentPaths, Func, Task>>? attachPaths = null, Func? isAttachingUnavailable = null, bool canRemove = true) { var dialogParameters = new DialogParameters { - { x => x.DocumentPaths, documentPaths } + { x => x.DocumentPaths, documentPaths }, + { x => x.CanRemove, canRemove }, }; if (attachPaths is not null)