⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
improvement(web): confirm before deleting an attachment (#415)
Carl Mercier2aa58ec68970
diff --git a/apps/web/messages/ar/initiatives.json b/apps/web/messages/ar/initiatives.jsonindex 83b250ec..a3455206 100644--- a/apps/web/messages/ar/initiatives.json+++ b/apps/web/messages/ar/initiatives.json@@ -153,7 +153,9 @@"open": "فتح {name}","download": "تنزيل","downloadFile": "تنزيل {name}",- "deleteFile": "حذف {name}"+ "deleteFile": "حذف {name}",+ "deleteTitle": "حذف المرفق",+ "deleteConfirmation": "حذف {name}؟ سيُزال أيضًا من الوصف في كل موضع مضمَّن فيه. لا يمكن التراجع عن ذلك."},"documents": {"title": "المستندات",diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.jsonindex 1d72add3..03984ef3 100644--- a/apps/web/messages/ar/issue.json+++ b/apps/web/messages/ar/issue.json@@ -140,6 +140,8 @@"download": "تنزيل","downloadFile": "تنزيل {name}","deleteFile": "حذف {name}",+ "deleteTitle": "حذف المرفق",+ "deleteConfirmation": "حذف {name}؟ سيُزال أيضًا من الوصف في كل موضع مضمَّن فيه. لا يمكن التراجع عن ذلك.","preview": "معاينة {name}","remove": "إزالة {name}","removeShort": "إزالة",diff --git a/apps/web/messages/en/initiatives.json b/apps/web/messages/en/initiatives.jsonindex 7bcfaa4f..2f70ae66 100644--- a/apps/web/messages/en/initiatives.json+++ b/apps/web/messages/en/initiatives.json@@ -153,7 +153,9 @@"open": "Open {name}","download": "Download","downloadFile": "Download {name}",- "deleteFile": "Delete {name}"+ "deleteFile": "Delete {name}",+ "deleteTitle": "Delete attachment",+ "deleteConfirmation": "Delete {name}? It is also removed from the description wherever it is embedded. This cannot be undone."},"documents": {"title": "Docs",diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.jsonindex 02699842..eae187b0 100644--- a/apps/web/messages/en/issue.json+++ b/apps/web/messages/en/issue.json@@ -140,6 +140,8 @@"download": "Download","downloadFile": "Download {name}","deleteFile": "Delete {name}",+ "deleteTitle": "Delete attachment",+ "deleteConfirmation": "Delete {name}? It is also removed from the description wherever it is embedded. This cannot be undone.","preview": "Preview {name}","remove": "Remove {name}","removeShort": "Remove",diff --git a/apps/web/messages/es-ES/initiatives.json b/apps/web/messages/es-ES/initiatives.jsonindex eb32308f..4dd013bc 100644--- a/apps/web/messages/es-ES/initiatives.json+++ b/apps/web/messages/es-ES/initiatives.json@@ -153,7 +153,9 @@"open": "Abrir {name}","download": "Descargar","downloadFile": "Descargar {name}",- "deleteFile": "Eliminar {name}"+ "deleteFile": "Eliminar {name}",+ "deleteTitle": "Eliminar el archivo adjunto",+ "deleteConfirmation": "¿Eliminar {name}? También se quitará de la descripción allí donde esté incrustado. No se puede deshacer."},"documents": {"title": "Documentos",diff --git a/apps/web/messages/es-ES/issue.json b/apps/web/messages/es-ES/issue.jsonindex 9079f5b7..3913de64 100644--- a/apps/web/messages/es-ES/issue.json+++ b/apps/web/messages/es-ES/issue.json@@ -140,6 +140,8 @@"download": "Descargar","downloadFile": "Descargar {name}","deleteFile": "Eliminar {name}",+ "deleteTitle": "Eliminar el archivo adjunto",+ "deleteConfirmation": "¿Eliminar {name}? También se quitará de la descripción allí donde esté incrustado. No se puede deshacer.","preview": "Previsualizar {name}","remove": "Quitar {name}","removeShort": "Quitar",diff --git a/apps/web/messages/fr/initiatives.json b/apps/web/messages/fr/initiatives.jsonindex d3d255d2..2127ff70 100644--- a/apps/web/messages/fr/initiatives.json+++ b/apps/web/messages/fr/initiatives.json@@ -153,7 +153,9 @@"open": "Ouvrir {name}","download": "Télécharger","downloadFile": "Télécharger {name}",- "deleteFile": "Supprimer {name}"+ "deleteFile": "Supprimer {name}",+ "deleteTitle": "Supprimer la pièce jointe",+ "deleteConfirmation": "Supprimer {name} ? Le fichier est aussi retiré de la description partout où il est intégré. Cette action est irréversible."},"documents": {"title": "Documents",diff --git a/apps/web/messages/fr/issue.json b/apps/web/messages/fr/issue.jsonindex 8c8d9453..9fcf643f 100644--- a/apps/web/messages/fr/issue.json+++ b/apps/web/messages/fr/issue.json@@ -140,6 +140,8 @@"download": "Télécharger","downloadFile": "Télécharger {name}","deleteFile": "Supprimer {name}",+ "deleteTitle": "Supprimer la pièce jointe",+ "deleteConfirmation": "Supprimer {name} ? Le fichier est aussi retiré de la description partout où il est intégré. Cette action est irréversible.","preview": "Aperçu de {name}","remove": "Retirer {name}","removeShort": "Retirer",diff --git a/apps/web/messages/id/initiatives.json b/apps/web/messages/id/initiatives.jsonindex ce0e3fee..6345685c 100644--- a/apps/web/messages/id/initiatives.json+++ b/apps/web/messages/id/initiatives.json@@ -153,7 +153,9 @@"open": "Buka {name}","download": "Unduh","downloadFile": "Unduh {name}",- "deleteFile": "Hapus {name}"+ "deleteFile": "Hapus {name}",+ "deleteTitle": "Hapus lampiran",+ "deleteConfirmation": "Hapus {name}? Berkas ini juga akan dihapus dari deskripsi di mana pun disematkan. Tindakan ini tidak dapat dibatalkan."},"documents": {"title": "Dokumen",diff --git a/apps/web/messages/id/issue.json b/apps/web/messages/id/issue.jsonindex e6d1ddf6..388999eb 100644--- a/apps/web/messages/id/issue.json+++ b/apps/web/messages/id/issue.json@@ -140,6 +140,8 @@"download": "Unduh","downloadFile": "Unduh {name}","deleteFile": "Hapus {name}",+ "deleteTitle": "Hapus lampiran",+ "deleteConfirmation": "Hapus {name}? Berkas ini juga akan dihapus dari deskripsi di mana pun disematkan. Tindakan ini tidak dapat dibatalkan.","preview": "Pratinjau {name}","remove": "Hapus {name}","removeShort": "Hapus",diff --git a/apps/web/messages/pt-BR/initiatives.json b/apps/web/messages/pt-BR/initiatives.jsonindex c79e5615..eb5cd2fa 100644--- a/apps/web/messages/pt-BR/initiatives.json+++ b/apps/web/messages/pt-BR/initiatives.json@@ -153,7 +153,9 @@"open": "Abrir {name}","download": "Baixar","downloadFile": "Baixar {name}",- "deleteFile": "Excluir {name}"+ "deleteFile": "Excluir {name}",+ "deleteTitle": "Excluir anexo",+ "deleteConfirmation": "Excluir {name}? Ele também será removido da descrição onde estiver incorporado. Isso não pode ser desfeito."},"documents": {"title": "Documentos",diff --git a/apps/web/messages/pt-BR/issue.json b/apps/web/messages/pt-BR/issue.jsonindex 3cced5c8..aa03cfe5 100644--- a/apps/web/messages/pt-BR/issue.json+++ b/apps/web/messages/pt-BR/issue.json@@ -140,6 +140,8 @@"download": "Baixar","downloadFile": "Baixar {name}","deleteFile": "Excluir {name}",+ "deleteTitle": "Excluir anexo",+ "deleteConfirmation": "Excluir {name}? Ele também será removido da descrição onde estiver incorporado. Isso não pode ser desfeito.","preview": "Visualizar {name}","remove": "Remover {name}","removeShort": "Remover",diff --git a/apps/web/messages/ru/initiatives.json b/apps/web/messages/ru/initiatives.jsonindex 9d2f5de9..14f3536c 100644--- a/apps/web/messages/ru/initiatives.json+++ b/apps/web/messages/ru/initiatives.json@@ -153,7 +153,9 @@"open": "Открыть {name}","download": "Скачать","downloadFile": "Скачать {name}",- "deleteFile": "Удалить {name}"+ "deleteFile": "Удалить {name}",+ "deleteTitle": "Удалить вложение",+ "deleteConfirmation": "Удалить {name}? Файл также будет убран из описания везде, где он встроен. Действие нельзя отменить."},"documents": {"title": "Документы",diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.jsonindex 8feea145..9481e290 100644--- a/apps/web/messages/ru/issue.json+++ b/apps/web/messages/ru/issue.json@@ -140,6 +140,8 @@"download": "Скачать","downloadFile": "Скачать {name}","deleteFile": "Удалить {name}",+ "deleteTitle": "Удалить вложение",+ "deleteConfirmation": "Удалить {name}? Файл также будет убран из описания везде, где он встроен. Действие нельзя отменить.","preview": "Посмотреть {name}","remove": "Убрать {name}","removeShort": "Убрать",diff --git a/apps/web/messages/uk/initiatives.json b/apps/web/messages/uk/initiatives.jsonindex 3a158df4..22e3290b 100644--- a/apps/web/messages/uk/initiatives.json+++ b/apps/web/messages/uk/initiatives.json@@ -153,7 +153,9 @@"open": "Відкрити {name}","download": "Завантажити","downloadFile": "Завантажити {name}",- "deleteFile": "Видалити {name}"+ "deleteFile": "Видалити {name}",+ "deleteTitle": "Видалити вкладення",+ "deleteConfirmation": "Видалити {name}? Файл також буде прибрано з опису всюди, де він вбудований. Дію неможливо скасувати."},"documents": {"title": "Документи",diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.jsonindex 7323ed6d..3517af14 100644--- a/apps/web/messages/uk/issue.json+++ b/apps/web/messages/uk/issue.json@@ -140,6 +140,8 @@"download": "Завантажити","downloadFile": "Завантажити {name}","deleteFile": "Видалити {name}",+ "deleteTitle": "Видалити вкладення",+ "deleteConfirmation": "Видалити {name}? Файл також буде прибрано з опису всюди, де він вбудований. Дію неможливо скасувати.","preview": "Переглянути {name}","remove": "Прибрати {name}","removeShort": "Прибрати",diff --git a/apps/web/messages/zh-CN/initiatives.json b/apps/web/messages/zh-CN/initiatives.jsonindex d21293cd..6a918788 100644--- a/apps/web/messages/zh-CN/initiatives.json+++ b/apps/web/messages/zh-CN/initiatives.json@@ -153,7 +153,9 @@"open": "打开 {name}","download": "下载","downloadFile": "下载 {name}",- "deleteFile": "删除 {name}"+ "deleteFile": "删除 {name}",+ "deleteTitle": "删除附件",+ "deleteConfirmation": "删除 {name}?它也会从描述中所有嵌入的位置移除。此操作无法撤销。"},"documents": {"title": "文档",diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.jsonindex 7a1586d4..49c5b710 100644--- a/apps/web/messages/zh-CN/issue.json+++ b/apps/web/messages/zh-CN/issue.json@@ -140,6 +140,8 @@"download": "下载","downloadFile": "下载 {name}","deleteFile": "删除 {name}",+ "deleteTitle": "删除附件",+ "deleteConfirmation": "删除 {name}?它也会从描述中所有嵌入的位置移除。此操作无法撤销。","preview": "预览 {name}","remove": "移除 {name}","removeShort": "移除",diff --git a/apps/web/src/features/initiatives/components/detail/InitiativeAttachments.tsx b/apps/web/src/features/initiatives/components/detail/InitiativeAttachments.tsxindex 13bcbcdf..9b7ed51a 100644--- a/apps/web/src/features/initiatives/components/detail/InitiativeAttachments.tsx+++ b/apps/web/src/features/initiatives/components/detail/InitiativeAttachments.tsx@@ -7,6 +7,7 @@ import type { Attachment } from '@/lib/api/endpoints/attachments';import { isImage, isVideo } from '@/components/common/editor/attachmentEmbed';import AttachmentThumb from '@/components/common/attachments/AttachmentThumb';import AttachmentViewer from '@/components/common/attachments/AttachmentViewer';+import ConfirmDialog from '@/components/common/overlay/ConfirmDialog';import { Button } from '@/components/ui/button';import { useFileDragZone } from '@/hooks/useFileDragZone';import { usePermissions } from '@/hooks/usePermissions';@@ -33,6 +34,7 @@ export default function InitiativeAttachments({ initiativeId }: { initiativeId:const limits = useStorageSettingsQuery().data;const [error, setError] = useState<string | null>(null);const [viewing, setViewing] = useState<Attachment | null>(null);+ const [deleting, setDeleting] = useState<Attachment | null>(null);const fileInput = useRef<HTMLInputElement>(null);async function send(files: FileList | null) {@@ -134,7 +136,7 @@ export default function InitiativeAttachments({ initiativeId }: { initiativeId:className="size-7 text-muted-foreground hover:text-destructive"title={tCommon('delete')}aria-label={t('deleteFile', { name: a.filename })}- onClick={() => remove.mutate(a.id)}+ onClick={() => setDeleting(a)}><Trash2 /></Button>@@ -147,6 +149,22 @@ export default function InitiativeAttachments({ initiativeId }: { initiativeId:{viewing && <AttachmentViewer attachment={viewing} onClose={() => setViewing(null)} />}+ {deleting && (+ <ConfirmDialog+ title={t('deleteTitle')}+ confirmLabel={tCommon('delete')}+ onConfirm={async () => {+ await remove.mutateAsync(deleting.id);+ setDeleting(null);+ }}+ onClose={() => setDeleting(null)}+ >+ <p className="text-sm text-muted-foreground">+ {t('deleteConfirmation', { name: deleting.filename })}+ </p>+ </ConfirmDialog>+ )}+{draggedFiles !== null && (<div className="pointer-events-none absolute inset-0 z-30 flex flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-primary bg-background/80 text-primary backdrop-blur-sm"><Download className="size-6" />diff --git a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsxindex 07ad549c..0f07cfa4 100644--- a/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx+++ b/apps/web/src/features/issue/components/detail/IssueAttachmentsPanel.tsx@@ -13,6 +13,7 @@ import { baseName } from '../../utils/filename';import IssueImageAnnotator from '../IssueImageAnnotator';import IssueAttachmentCard from './IssueAttachmentCard';import AttachmentViewer from '@/components/common/attachments/AttachmentViewer';+import ConfirmDialog from '@/components/common/overlay/ConfirmDialog';import IssueSectionHeading from './IssueSectionHeading';import { useStorageSettingsQuery } from '@/services/storage.service';import { attachmentAccept, attachmentError, attachmentLimitHint } from '@/utils/uploadLimits';@@ -35,6 +36,7 @@ export default function IssueAttachmentsPanel({readOnly?: boolean;}) {const t = useTranslations('issue.attachments');+ const tCommon = useTranslations('common');const attachmentsQuery = useAttachmentsQuery(issueId);const items = attachmentsQuery.data ?? [];const uploadAttachment = useUploadAttachment();@@ -44,6 +46,7 @@ export default function IssueAttachmentsPanel({const [error, setError] = useState<string | null>(null);const [annotating, setAnnotating] = useState<Attachment | null>(null);const [viewing, setViewing] = useState<Attachment | null>(null);+ const [deleting, setDeleting] = useState<Attachment | null>(null);// A replaced attachment keeps its URL, which the image optimizer caches its// thumbnail under. Stamping the ones replaced here tells the two versions apart.const [replacedAt, setReplacedAt] = useState<Record<string, number>>({});@@ -131,7 +134,7 @@ export default function IssueAttachmentsPanel({onOpen={() => setViewing(a)}onInsert={() => onInsert(a)}onAnnotate={() => setAnnotating(a)}- onDelete={() => deleteAttachment.mutate(a.id)}+ onDelete={() => setDeleting(a)}readOnly={readOnly}/>))}@@ -140,6 +143,22 @@ export default function IssueAttachmentsPanel({{viewing && <AttachmentViewer attachment={viewing} onClose={() => setViewing(null)} />}+ {deleting && (+ <ConfirmDialog+ title={t('deleteTitle')}+ confirmLabel={tCommon('delete')}+ onConfirm={async () => {+ await deleteAttachment.mutateAsync(deleting.id);+ setDeleting(null);+ }}+ onClose={() => setDeleting(null)}+ >+ <p className="text-sm text-muted-foreground">+ {t('deleteConfirmation', { name: deleting.filename })}+ </p>+ </ConfirmDialog>+ )}+{annotating && (<IssueImageAnnotatorsrc={annotating.url}