From 1cb78a309eb65ce01a3404f4325b4c3e57e8efd1 Mon Sep 17 00:00:00 2001 From: SoleroTG Date: Wed, 17 Jun 2026 21:49:24 +0200 Subject: [PATCH] feat: Add 'copy direct link' action to message menu Implements a UI button in the MenuEnvelope to generate and copy a direct link to the message using the new deep link route. Utilizes the standard Nextcloud clipboard fallback via window.prompt for non-secure contexts. Signed-off-by: SoleroTG --- src/components/MenuEnvelope.vue | 50 ++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/components/MenuEnvelope.vue b/src/components/MenuEnvelope.vue index 0f1fe735ce..5f989e5903 100644 --- a/src/components/MenuEnvelope.vue +++ b/src/components/MenuEnvelope.vue @@ -1,5 +1,5 @@ @@ -29,6 +29,21 @@ {{ t('mail', 'Forward') }} + + + {{ copied ? t('mail', 'Link copied') : t('mail', 'Copy direct link') }} + $/g, '') + const url = window.location.origin + generateUrl('/apps/mail/open/' + encodeURIComponent(trimmedMessageId)) + + try { + await navigator.clipboard.writeText(url) + this.copied = true + showSuccess(t('mail', 'Direct link copied to clipboard')) + } catch (error) { + // Fallback for cases where clipboard API is not available (e.g. non-HTTPS localhost) + // or permission is denied. This exactly matches Nextcloud's useCopy composable behavior. + window.prompt(t('mail', 'Copy direct link'), url) + } finally { + this.copyResetTimer = setTimeout(() => { + this.copied = false + this.localMoreActionsOpen = false + }, 2000) + } + }, + isSieveEnabled() { return this.account.sieveEnabled },