From ddc097e0975d8905c93ab3e35576bfb2e97e124f Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Fri, 23 Oct 2026 13:33:39 +0530 Subject: [PATCH] [Share By Email] Add an optional default recipient Users who mostly share articles with the same address (e.g. their own mailbox or a read-later service) have to type it again every time. Add a "Default recipient" email field to the extension configuration, stored in the `share_by_email_default_recipient` user attribute, and use it to prefill the "To" field of the sharing form. The field can still be edited before sending, and leaving the setting empty keeps the current behaviour. The address is validated with PHPMailer in the same way FreshRSS core validates user email addresses; an invalid address is rejected with the core "invalid email" message and the previous value is kept. Add translations for all supported languages, document the option in the README and bump the extension version to 0.5.0. Fixes #129 --- .../Controllers/shareByEmailController.php | 3 ++ xExtension-ShareByEmail/README.md | 3 ++ xExtension-ShareByEmail/configure.phtml | 29 ++++++++++++++++ xExtension-ShareByEmail/extension.php | 33 +++++++++++++++++++ .../i18n/de/shareByEmail.php | 2 ++ .../i18n/en/shareByEmail.php | 2 ++ .../i18n/fr/shareByEmail.php | 2 ++ .../i18n/tr/shareByEmail.php | 2 ++ xExtension-ShareByEmail/metadata.json | 2 +- 9 files changed, 77 insertions(+), 1 deletion(-) diff --git a/xExtension-ShareByEmail/Controllers/shareByEmailController.php b/xExtension-ShareByEmail/Controllers/shareByEmailController.php index 77d08fca..d721a737 100644 --- a/xExtension-ShareByEmail/Controllers/shareByEmailController.php +++ b/xExtension-ShareByEmail/Controllers/shareByEmailController.php @@ -57,6 +57,9 @@ public function shareAction(): void { Minz_View::appendStyle($this->extension->getFileUrl('shareByEmail.css')); } $this->view->to = ''; + if ($this->extension instanceof ShareByEmailExtension) { + $this->view->to = htmlspecialchars($this->extension->getDefaultRecipient(), ENT_COMPAT, 'UTF-8'); + } $this->view->subject = _t('shareByEmail.share.form.subject_default'); $this->view->content = _t( 'shareByEmail.share.form.content_default', diff --git a/xExtension-ShareByEmail/README.md b/xExtension-ShareByEmail/README.md index d1a0ffb2..6acac455 100644 --- a/xExtension-ShareByEmail/README.md +++ b/xExtension-ShareByEmail/README.md @@ -12,8 +12,11 @@ After the installation the `Email` sharing service will added to the list of ava You will have to configure the mailing system in FreshRSS. [See the documentation](https://freshrss.github.io/FreshRSS/en/admins/05_Configuring_email_validation.html#configure-the-smtp-server) +Optionally, you can set a default recipient in the extension configuration, which will prefill the “To” field of the sharing form. + ## Changelog +- 0.5.0 Optional default recipient to prefill the sharing form - 0.3.2 With the new feature, Turkish language deficiencies have been corrected. - 0.3.0 detail information about the mail system shown in the extension config - 0.2.3 Turkish language support added diff --git a/xExtension-ShareByEmail/configure.phtml b/xExtension-ShareByEmail/configure.phtml index ac30a38b..c8291b65 100644 --- a/xExtension-ShareByEmail/configure.phtml +++ b/xExtension-ShareByEmail/configure.phtml @@ -1,5 +1,6 @@
= _i('help') ?> = _t('shareByEmail.share.manage.help') ?>
mail()',
'smtp' => 'via SMTP (versendet von %s)',
diff --git a/xExtension-ShareByEmail/i18n/en/shareByEmail.php b/xExtension-ShareByEmail/i18n/en/shareByEmail.php
index 49c8784c..8ae22f38 100644
--- a/xExtension-ShareByEmail/i18n/en/shareByEmail.php
+++ b/xExtension-ShareByEmail/i18n/en/shareByEmail.php
@@ -19,6 +19,8 @@
'intro' => 'You are about to share this article by email: “%s”',
'title' => 'Share an article by email',
'manage' => [
+ 'default_recipient' => 'Default recipient',
+ 'default_recipient_help' => 'Prefills the “To” field when sharing an article. Leave empty to have no default recipient.',
'mailer' => 'Mailing system',
'mail' => 'PHP mail()',
'smtp' => 'SMTP (send from %s)',
diff --git a/xExtension-ShareByEmail/i18n/fr/shareByEmail.php b/xExtension-ShareByEmail/i18n/fr/shareByEmail.php
index 9343f357..4d3be13d 100644
--- a/xExtension-ShareByEmail/i18n/fr/shareByEmail.php
+++ b/xExtension-ShareByEmail/i18n/fr/shareByEmail.php
@@ -19,6 +19,8 @@
'intro' => 'Vous êtes sur le point de partager cet article par courriel : « %s »',
'title' => 'Partager un article par courriel',
'manage' => [
+ 'default_recipient' => 'Destinataire par défaut',
+ 'default_recipient_help' => 'Pré-remplit le champ « Pour » lors du partage d’un article. Laisser vide pour ne pas avoir de destinataire par défaut.',
'mailer' => 'Système de messagerie',
'mail' => 'PHP mail()',
'smtp' => 'SMTP (envoyer en tant que %s)',
diff --git a/xExtension-ShareByEmail/i18n/tr/shareByEmail.php b/xExtension-ShareByEmail/i18n/tr/shareByEmail.php
index b2cca3ff..fbcfccc4 100644
--- a/xExtension-ShareByEmail/i18n/tr/shareByEmail.php
+++ b/xExtension-ShareByEmail/i18n/tr/shareByEmail.php
@@ -19,6 +19,8 @@
'intro' => 'Bu makaleyi e-posta yoluyla paylaşmak üzeresiniz: “%s”',
'title' => 'Bir makaleyi e-posta ile paylaşın',
'manage' => [
+ 'default_recipient' => 'Varsayılan alıcı',
+ 'default_recipient_help' => 'Bir makale paylaşılırken “Kime” alanını önceden doldurur. Varsayılan alıcı istemiyorsanız boş bırakın.',
'mailer' => 'Mail sistemi',
'mail' => 'PHP mail()',
'smtp' => 'SMTP (%s kaynağından gönder)',
diff --git a/xExtension-ShareByEmail/metadata.json b/xExtension-ShareByEmail/metadata.json
index e8bba61e..3e1befc7 100644
--- a/xExtension-ShareByEmail/metadata.json
+++ b/xExtension-ShareByEmail/metadata.json
@@ -2,7 +2,7 @@
"name": "Share By Email",
"author": "Marien Fressinaud",
"description": "Improve the sharing by email system.",
- "version": "0.4.0",
+ "version": "0.5.0",
"entrypoint": "ShareByEmail",
"type": "user"
}