Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(frontend:files): prompt before downloading files without a preview

johaven161aa516a080
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
index 969559ee..3338600e 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -464,12 +464,14 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
shortcutOpen() {
- if (this.selection[0].isDir) {
- this.browse(this.selection[0])
- } else if (this.selection[0].isViewable || this.selection[0].isEditable) {
+ const file = this.selection[0]
+ if (!file) return
+ if (file.isDir) {
+ this.browse(file)
+ } else if (file.isViewable || file.isEditable) {
this.openViewerDialog()
} else {
- this.downloadFiles()
+ this.notifyPreviewUnavailable(file)
}
}
@@ -729,6 +731,17 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
return f
}
+ private notifyPreviewUnavailable(file: FileModel) {
+ const message = `
+ <div>${this.layout.translateString('No preview available for this file')}</div>
+ <div class="mt-3 fw-bold">${this.layout.translateString('Click to download')}</div>
+ `
+ const notification = this.layout.sendNotification('info', file.name, message, null, { enableHtml: true }, true)
+ if (notification) {
+ notification.onTap.pipe(take(1)).subscribe(() => this.filesService.download(file))
+ }
+ }
+
private openViewerDialog() {
const f = this.selection[0]
let permissions: string
diff --git a/frontend/src/app/layout/layout.service.ts b/frontend/src/app/layout/layout.service.ts
index b5799238..130028c4 100644
--- a/frontend/src/app/layout/layout.service.ts
+++ b/frontend/src/app/layout/layout.service.ts
@@ -229,9 +229,10 @@ export class LayoutService {
title: string,
message: string,
e?: HttpErrorResponse,
- override: any = {}
+ override: any = {},
+ forceLocal = false
): ActiveToast<any> | void {
- const useSystemNotifications = this.electron.enabled && (this.store.user.getValue()?.preferences?.useSystemNotifications ?? true)
+ const useSystemNotifications = !forceLocal && this.electron.enabled && (this.store.user.getValue()?.preferences?.useSystemNotifications ?? true)
if (type === 'error' && e) {
const errorMessage = e.error
? Array.isArray(e.error.message)
diff --git a/frontend/src/i18n/ca.json b/frontend/src/i18n/ca.json
index 07d548f4..a11c4aa1 100644
--- a/frontend/src/i18n/ca.json
+++ b/frontend/src/i18n/ca.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "No es pot actualitzar la preferència de notificacions",
"Unable to update full-text search preference": "No es pot actualitzar la preferència de cerca de text complet",
"Unable to open document": "No es pot obrir el document",
+ "No preview available for this file": "No hi ha cap vista prèvia disponible per a aquest fitxer",
+ "Click to download": "Feu clic per descarregar",
"Unable to save document": "No es pot desar el document",
"Home": "Inici",
"Recents": "Recents",
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index ceaec0c9..a852daf0 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Benachrichtigungseinstellung kann nicht aktualisiert werden",
"Unable to update full-text search preference": "Volltextsuche-Einstellung kann nicht aktualisiert werden",
"Unable to open document": "Dokument kann nicht geöffnet werden",
+ "No preview available for this file": "Für diese Datei ist keine Vorschau verfügbar",
+ "Click to download": "Zum Herunterladen klicken",
"Unable to save document": "Dokument kann nicht gespeichert werden",
"Home": "Startseite",
"Recents": "Zuletzt verwendet",
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index e9ec9fc8..90761b7d 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "No se puede actualizar la preferencia de notificaciones",
"Unable to update full-text search preference": "No se puede actualizar la preferencia de búsqueda de texto completo",
"Unable to open document": "No se puede abrir el documento",
+ "No preview available for this file": "No hay una vista previa disponible para este archivo",
+ "Click to download": "Haga clic para descargar",
"Unable to save document": "No se puede guardar el documento",
"Home": "Inicio",
"Recents": "Recientes",
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index d404df05..389c055c 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Impossible de mettre à jour la préférence de notification",
"Unable to update full-text search preference": "Impossible de mettre à jour la préférence de recherche full-text",
"Unable to open document": "Impossible d'ouvrir le document",
+ "No preview available for this file": "Aucun aperçu disponible pour ce fichier",
+ "Click to download": "Cliquez pour télécharger",
"Unable to save document": "Impossible d’enregistrer le document",
"Home": "Accueil",
"Recents": "Récents",
diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.json
index 1baa51b8..16ebf25a 100644
--- a/frontend/src/i18n/hi.json
+++ b/frontend/src/i18n/hi.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "सूचना प्राथमिकता अपडेट नहीं की जा सकी",
"Unable to update full-text search preference": "पूर्ण-पाठ खोज प्राथमिकता अपडेट नहीं की जा सकी",
"Unable to open document": "दस्तावेज़ नहीं खोला जा सका",
+ "No preview available for this file": "इस फ़ाइल का पूर्वावलोकन उपलब्ध नहीं है",
+ "Click to download": "डाउनलोड करने के लिए क्लिक करें",
"Unable to save document": "दस्तावेज़ सहेजा नहीं जा सका",
"Home": "होम",
"Recents": "हाल के",
diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json
index 89fc2af3..f7eead76 100644
--- a/frontend/src/i18n/it.json
+++ b/frontend/src/i18n/it.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Impossibile aggiornare la preferenza di notifica",
"Unable to update full-text search preference": "Impossibile aggiornare la preferenza di ricerca full-text",
"Unable to open document": "Impossibile aprire il documento",
+ "No preview available for this file": "Nessuna anteprima disponibile per questo file",
+ "Click to download": "Fai clic per scaricare",
"Unable to save document": "Impossibile salvare il documento",
"Home": "Home",
"Recents": "Recenti",
diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json
index 98a91ca1..f560ee83 100644
--- a/frontend/src/i18n/ja.json
+++ b/frontend/src/i18n/ja.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "通知設定を更新できません",
"Unable to update full-text search preference": "フルテキスト検索設定を更新できません",
"Unable to open document": "ドキュメントを開けません",
+ "No preview available for this file": "このファイルのプレビューは利用できません",
+ "Click to download": "クリックしてダウンロード",
"Unable to save document": "ドキュメントを保存できません",
"Home": "ホーム",
"Recents": "最近",
diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.json
index 79149f86..063bd58f 100644
--- a/frontend/src/i18n/ko.json
+++ b/frontend/src/i18n/ko.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "알림 설정을 업데이트할 수 없습니다",
"Unable to update full-text search preference": "전문 검색 설정을 업데이트할 수 없습니다",
"Unable to open document": "문서를 열 수 없습니다",
+ "No preview available for this file": "이 파일은 미리보기를 지원하지 않습니다",
+ "Click to download": "클릭하여 다운로드",
"Unable to save document": "문서를 저장할 수 없습니다",
"Home": "홈",
"Recents": "최근 항목",
diff --git a/frontend/src/i18n/nl.json b/frontend/src/i18n/nl.json
index c133fe02..07a60f10 100644
--- a/frontend/src/i18n/nl.json
+++ b/frontend/src/i18n/nl.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Kan meldingsvoorkeur niet bijwerken",
"Unable to update full-text search preference": "Kan instellingen voor volledige-tekst zoeken niet bijwerken",
"Unable to open document": "Kan document niet openen",
+ "No preview available for this file": "Er is geen voorbeeld beschikbaar voor dit bestand",
+ "Click to download": "Klik om te downloaden",
"Unable to save document": "Kan document niet opslaan",
"Home": "Thuis",
"Recents": "Recente bestanden",
diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.json
index 9d302753..d1e1febe 100644
--- a/frontend/src/i18n/pl.json
+++ b/frontend/src/i18n/pl.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Nie można zaktualizować preferencji powiadomień",
"Unable to update full-text search preference": "Nie można zaktualizować preferencji wyszukiwania pełnotekstowego",
"Unable to open document": "Nie można otworzyć dokumentu",
+ "No preview available for this file": "Podgląd tego pliku jest niedostępny",
+ "Click to download": "Kliknij, aby pobrać",
"Unable to save document": "Nie można zapisać dokumentu",
"Home": "Strona główna",
"Recents": "Ostatnie",
diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json
index 92ab5d60..d9f2fda0 100644
--- a/frontend/src/i18n/pt-BR.json
+++ b/frontend/src/i18n/pt-BR.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Não foi possível atualizar a preferência de notificação",
"Unable to update full-text search preference": "Não foi possível atualizar a preferência de pesquisa de texto completo",
"Unable to open document": "Não foi possível abrir o documento",
+ "No preview available for this file": "Não há pré-visualização disponível para este arquivo",
+ "Click to download": "Clique para baixar",
"Unable to save document": "Não é possível salvar o documento",
"Home": "Início",
"Recents": "Recentes",
diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.json
index b09e6634..3eb9987a 100644
--- a/frontend/src/i18n/pt.json
+++ b/frontend/src/i18n/pt.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Não é possível atualizar a preferência de notificação",
"Unable to update full-text search preference": "Não é possível atualizar a preferência de pesquisa de texto completo",
"Unable to open document": "Não é possível abrir o documento",
+ "No preview available for this file": "Não há pré-visualização disponível para este ficheiro",
+ "Click to download": "Clique para descarregar",
"Unable to save document": "Não é possível salvar o documento",
"Home": "Início",
"Recents": "Recentes",
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index 8a172e7e..78f370c4 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Не удалось обновить настройки уведомлений",
"Unable to update full-text search preference": "Не удалось обновить настройки полнотекстового поиска",
"Unable to open document": "Не удалось открыть документ",
+ "No preview available for this file": "Предварительный просмотр этого файла недоступен",
+ "Click to download": "Нажмите, чтобы скачать",
"Unable to save document": "Не удалось сохранить документ",
"Home": "Главная",
"Recents": "Недавние",
diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.json
index 3ecdecbc..d19c3b4e 100644
--- a/frontend/src/i18n/tr.json
+++ b/frontend/src/i18n/tr.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "Bildirim tercihi güncellenemedi",
"Unable to update full-text search preference": "Tam metin arama tercihi güncellenemedi",
"Unable to open document": "Belge açılamadı",
+ "No preview available for this file": "Bu dosya için önizleme kullanılamıyor",
+ "Click to download": "İndirmek için tıklayın",
"Unable to save document": "Belge kaydedilemedi",
"Home": "Ana sayfa",
"Recents": "Son kullanılanlar",
diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.json
index 5bd35ca2..3746275b 100644
--- a/frontend/src/i18n/zh.json
+++ b/frontend/src/i18n/zh.json
@@ -216,6 +216,8 @@
"Unable to update notification preference": "无法更新通知偏好",
"Unable to update full-text search preference": "无法更新全文搜索偏好",
"Unable to open document": "无法打开文档",
+ "No preview available for this file": "此文件无法预览",
+ "Click to download": "点击下载",
"Unable to save document": "无法保存文档",
"Home": "首页",
"Recents": "最近",