Skip to content

Commit

Permalink
pkp/pkp-lib#5716 Add new manage emails UI and remove email templates …
Browse files Browse the repository at this point in the history
…list
  • Loading branch information
NateWr committed Nov 3, 2022
1 parent 3e1a1a2 commit f7931b5
Show file tree
Hide file tree
Showing 110 changed files with 320 additions and 1,042 deletions.
35 changes: 0 additions & 35 deletions classes/components/listPanels/EmailTemplatesListPanel.php

This file was deleted.

2 changes: 1 addition & 1 deletion classes/mail/mailables/IssuePublishedNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class IssuePublishedNotify extends Mailable
protected static ?string $description = 'mailable.issuePublishNotify.description';
protected static ?string $emailTemplateKey = 'ISSUE_PUBLISH_NOTIFY';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [Role::ROLE_ID_MANAGER];
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

protected static string $issueIdentification = 'issueIdentification';
Expand Down
1 change: 1 addition & 0 deletions classes/mail/mailables/OpenAccessNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class OpenAccessNotify extends Mailable
protected static ?string $description = 'mailable.openAccessNotify.description';
protected static ?string $emailTemplateKey = 'OPEN_ACCESS_NOTIFY';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [self::FROM_SYSTEM];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

protected Journal $context;
Expand Down
1 change: 1 addition & 0 deletions classes/mail/mailables/SubscriptionExpired.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SubscriptionExpired extends Mailable
protected static ?string $description = 'mailable.subscriptionExpired.description';
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_AFTER_EXPIRY';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [self::FROM_SYSTEM];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
Expand Down
1 change: 1 addition & 0 deletions classes/mail/mailables/SubscriptionExpiredLast.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SubscriptionExpiredLast extends Mailable
protected static ?string $description = 'mailable.subscriptionExpiredLast.description';
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_AFTER_EXPIRY_LAST';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [self::FROM_SYSTEM];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
Expand Down
5 changes: 3 additions & 2 deletions classes/mail/mailables/SubscriptionExpiresSoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ class SubscriptionExpiresSoon extends Mailable
use Recipient;
use SubscriptionTypeVariables;

protected static ?string $name = 'mailable.SubscriptionExpiresSoon.name';
protected static ?string $description = 'mailable.SubscriptionExpiresSoon.description';
protected static ?string $name = 'mailable.subscriptionExpiresSoon.name';
protected static ?string $description = 'mailable.subscriptionExpiresSoon.description';
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_BEFORE_EXPIRY';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [self::FROM_SYSTEM];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
Expand Down
2 changes: 1 addition & 1 deletion classes/mail/mailables/SubscriptionNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SubscriptionNotify extends Mailable
protected static ?string $description = 'mailable.subscriptionNotify.description';
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_NOTIFY';
protected static array $groupIds = [self::GROUP_OTHER];
protected static array $fromRoleIds = [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUBSCRIPTION_MANAGER];
protected static array $fromRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
protected static array $toRoleIds = [Role::ROLE_ID_READER];

public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I5716_EmailTemplateAssignments.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2000-2022 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I5716_EmailTemplateAssignments
* @brief Refactors relationship between Mailables and Email Templates
*/

namespace APP\migration\upgrade\v3_4_0;

use Illuminate\Support\Collection;
use PKP\mail\mailables\DiscussionCopyediting;
use PKP\mail\mailables\DiscussionProduction;
use PKP\mail\mailables\DiscussionReview;
use PKP\mail\mailables\DiscussionSubmission;

class I5716_EmailTemplateAssignments extends \PKP\migration\upgrade\v3_4_0\I5716_EmailTemplateAssignments
{
protected function getContextTable(): string
{
return 'journals';
}

protected function getContextSettingsTable(): string
{
return 'journal_settings';
}

protected function getContextIdColumn(): string
{
return 'journal_id';
}

protected function getDiscussionTemplates(): Collection
{
return collect([
DiscussionSubmission::getEmailTemplateKey(),
DiscussionReview::getEmailTemplateKey(),
DiscussionCopyediting::getEmailTemplateKey(),
DiscussionProduction::getEmailTemplateKey(),
]);
}
}
6 changes: 3 additions & 3 deletions classes/notification/form/NotificationSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
namespace APP\notification\form;

use APP\notification\Notification;

use PKP\context\Context;
use PKP\notification\form\PKPNotificationSettingsForm;

class NotificationSettingsForm extends PKPNotificationSettingsForm
{
/**
* @copydoc PKPNotificationSettingsForm::getNotificationSettingsCategories()
*/
public function getNotificationSettingCategories()
public function getNotificationSettingCategories(Context $context)
{
$categories = parent::getNotificationSettingCategories();
$categories = parent::getNotificationSettingCategories($context);
for ($i = 0; $i < count($categories); $i++) {
if ($categories[$i]['categoryKey'] === 'notification.type.public') {
$categories[$i]['settings'][] = Notification::NOTIFICATION_TYPE_PUBLISHED_ISSUE;
Expand Down
7 changes: 5 additions & 2 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
<migration class="PKP\migration\upgrade\v3_4_0\I7624_StrftimeDeprecation"/>
<migration class="PKP\migration\upgrade\v3_4_0\I7592_RemoveUnusedEmailTemplates"/>
<migration class="PKP\migration\upgrade\v3_4_0\I7126_Galleys"/>
<migration class="PKP\migration\upgrade\v3_4_0\I7706_AssociateTemplatesWithMailables"/>
<migration class="APP\migration\upgrade\v3_4_0\I7190_RemoveOrphanFilters" />
<migration class="PKP\migration\upgrade\v3_4_0\I7190_UpdateFilters" />
<migration class="PKP\migration\upgrade\v3_4_0\I8060_UpdateUserLocalesDefaultToEmptyArrayFromNull" />
Expand Down Expand Up @@ -179,6 +178,7 @@
<migration class="PKP\migration\upgrade\v3_4_0\I4789_AddReviewerRequestResentColumns"/>
<migration class="APP\migration\upgrade\v3_4_0\I7796_UpdateCrossrefSchema"/>
<migration class="PKP\migration\upgrade\v3_4_0\I7287_RemoveEmailTemplatesDefault"/>
<migration class="APP\migration\upgrade\v3_4_0\I5716_EmailTemplateAssignments"/>
<data file="dbscripts/xml/upgrade/3.4.0_preupdate_email_templates.xml" />
<code function="installEmailTemplate" key="EDITOR_DECISION_NOTIFY_OTHER_AUTHORS" locales="en_US" />
<code function="installEmailTemplate" key="EDITOR_DECISION_NEW_ROUND" locales="en_US" />
Expand All @@ -190,7 +190,10 @@
<code function="installEmailTemplate" key="EDITOR_DECISION_BACK_FROM_COPYEDITING" locales="en_US" />
<code function="installEmailTemplate" key="EDITOR_DECISION_CANCEL_REVIEW_ROUND" locales="en_US" />
<code function="installEmailTemplate" key="REVIEW_RESEND_REQUEST" locales="en_US" />
<code function="installEmailTemplate" key="DISCUSSION_NOTIFICATION" locales="en_US" />
<code function="installEmailTemplate" key="DISCUSSION_NOTIFICATION_SUBMISSION" locales="en_US" />
<code function="installEmailTemplate" key="DISCUSSION_NOTIFICATION_REVIEW" locales="en_US" />
<code function="installEmailTemplate" key="DISCUSSION_NOTIFICATION_COPYEDITING" locales="en_US" />
<code function="installEmailTemplate" key="DISCUSSION_NOTIFICATION_PRODUCTION" locales="en_US" />
<note file="docs/release-notes/README-3.4.0" />
</upgrade>

Expand Down
44 changes: 18 additions & 26 deletions docs/dev/swagger-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -2763,56 +2763,48 @@
"summary": "Get email templates.",
"parameters": [
{
"name": "isEnabled",
"description": "Filter results by enabled/disabled email templates. Any truthy or falsey value will get enabled/disabled email templates.",
"name": "alternateTo",
"description": "Filter results by those assigned to a `Mailable` with this default email template key.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "isCustom",
"description": "Filter results by those with or without a default template. A truthy value will return only templates with a key that does not match one of the default templates. A falsey value will return only templates with a key that matches one of the default templates. Note that a default template may be customized, but this does not qualify for `isCustom`. Only completely custom templates, not a customization of a default template, will be returned when `isCustom` is `true`.",
"description": "Filter results by those with or without a default template. A truthy value will return only templates with a key that does not match one of the default templates. A falsey value will return only templates with a key that matches one of the default templates. Note that a default template may be customized, but this does not qualify for `isCustom`. Only completely custom templates, not a customization of a default template, will be returned when `isCustom` is `true`. If you want to see default templates that have been customized, use `isModified`.",
"in": "query",
"required": false,
"type": "string"
"type": "boolean"
},
{
"name": "fromRoleIds",
"description": "Filter results by email templates sent by one or more role IDs.",
"name": "isModified",
"description": "Filter results by those that have been modified from the default template. This is different from `isCustom` because it will return custom templates alongside any default templates that have been modified.",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "integer"
}
"type": "boolean"
},
{
"name": "toRoleIds",
"description": "Filter results by email templates received by one or more role IDs.",
"name": "searchPhrase",
"description": "Filter results by a search phrase matched against the `key`, `subject`, `body`, or `description`.",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "integer"
}
"type": "string"
},
{
"name": "searchPhrase",
"description": "Filter results by a search phrase matched against the `key`, `subject`, `body`, or `description`.",
"name": "count",
"description": "How many templates to return in a single request. Max is `100`.",
"in": "query",
"required": false,
"type": "string"
"type": "type",
"default": 30
},
{
"name": "stageIds",
"description": "Filter results by email templates that belong to one or more workflow stage IDs. Pass `0` to return templates not assigned to a stage.",
"name": "offset",
"description": "Offset the templates returned. Use this to receive subsequent pages of requests.",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "integer"
}
}
"type": "integer"
},
],
"responses": {
"200": {
Expand Down
2 changes: 2 additions & 0 deletions js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import AdminPage from '@/components/Container/AdminPage.vue';
import DoiPage from '@/components/Container/DoiPageOJS.vue';
import DecisionPage from '@/components/Container/DecisionPage.vue';
import ImportExportPage from '@/components/Container/ImportExportPage.vue';
import ManageEmailsPage from '@/components/Container/ManageEmailsPage.vue';
import SettingsPage from '@/components/Container/SettingsPage.vue';
import StatsEditorialPage from '@/components/Container/StatsEditorialPage.vue';
import StatsPublicationsPage from '@/components/Container/StatsPublicationsPage.vue';
Expand All @@ -40,6 +41,7 @@ window.pkp = Object.assign(PkpLoad, {
DoiPage,
DecisionPage,
ImportExportPage,
ManageEmailsPage,
JobsPage,
Page,
SettingsPage,
Expand Down
16 changes: 2 additions & 14 deletions locale/ar_IQ/emails.po
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ msgstr ""
msgid "emails.lockssNewArchive.description"
msgstr "هذه الرسالة تشجع متلقيها على المبادرة إلى اعتماد العمل بنظام LOCKSS وتضمين هذه المجلة في الأرشيف الخاص به. إنها تتضمن معلومات عن تمهيد نظام LOCKSS وكيفية المشاركة فيه."

msgid "emails.submissionAckNotUser.subject"
msgid "emails.submissionAckNotAuthor.subject"
msgstr "تأكيد طلب التقديم"

msgid "emails.submissionAckNotUser.body"
msgid "emails.submissionAckNotAuthor.body"
msgstr ""
"<p>عزيزنا {$recipientName}،</p><p>لقد تمت تسميتك بمثابة مؤلف مشارك في طلب "
"تقديم إلى {$contextName}. مقدم الطلب، {$submitterName}، أعطانا التفاصيل "
Expand Down Expand Up @@ -578,9 +578,6 @@ msgstr ""
"المدقق، {$contextName}<br />\n"
""

msgid "emails.citationEditorAuthorQuery.description"
msgstr "هذه الرسالة تسمح لمدققي المجلة بالمطالبة بمعلومات إضافية عن المراجع من المؤلفين."

msgid "emails.revisedVersionNotify.subject"
msgstr "تم رفع نسخة منقحة"

Expand All @@ -594,15 +591,6 @@ msgstr ""
"<br />\n"
"{$signature}"

msgid "emails.notificationCenterDefault.subject"
msgstr "رسالة تتعلق بالمجلة {$contextName}"

msgid "emails.notificationCenterDefault.body"
msgstr "لطفاً أكتب رسالتك هنا."

msgid "emails.notificationCenterDefault.description"
msgstr "هذه الرسالة الإفتراضية (الخالية) التي يستعملها منشئ الرسائل في مركز إشعارات النظام."

msgid "emails.statisticsReportNotification.subject"
msgstr "نشاط هيئة التحرير لشهر {$month}، {$year}"

Expand Down
4 changes: 1 addition & 3 deletions locale/ar_IQ/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ msgstr "الوصول إلى بعض أو كل محتويات المجلة يتط
msgid "manager.website.archiving"
msgstr "الحفظ"

msgid "manager.emails.confirmResetAll"
msgstr "هل أنت متأكد من رغبتك في إعادة تعيين كل قوائم المراسلة في هذه المجلة؟ ستفقد أي تخصيصات سبق أن قمت بها."

msgid "manager.files.note"
msgstr "ملاحظة: مستعرض الملفات هو ميزة متقدمة تسمح بمعاينة الملفات وحوافظها المتعلقة بالمجلة فضلاً عن معالجتها مباشرة."

Expand Down Expand Up @@ -453,6 +450,7 @@ msgstr "تحديد هوية البريد الالكتروني"
msgid "manager.setup.emailSignature"
msgstr "التوقيع"

#, fuzzy
msgid "manager.setup.emailSignature.description"
msgstr "رسائل البريد الالكتروني المُحضرَّة آلياً والمرسلة من قبل النظام نيابة عن المجلة، ستكون مذيلة بالتوقيع الآتي، علماً أن محتوى تلك الرسائل قابل للتعديل ضمن باب (الإعدادات)."

Expand Down
6 changes: 1 addition & 5 deletions locale/be_BY@cyrillic/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ msgstr "Наведвальнікі могуць зарэгістраваць у
msgid "manager.setup.enableAnnouncements.enable"
msgstr "Дазволіць кіраўнікам часопісаў дабаўляць аб'явы ў часопісы"

#, fuzzy
msgid "manager.setup.emailSignature.description"
msgstr ""
"Падрыхтаваныя пісьмы, якія адпраўляюцца сістэмай ад імя часопіса, будуць "
Expand Down Expand Up @@ -941,10 +942,5 @@ msgstr ""
"непасрэдна праглядаць і кіраваць файламі і каталогамі, звязанымі з гэтым "
"часопісам."

msgid "manager.emails.confirmResetAll"
msgstr ""
"Вы ўпэўнены, што хочаце замяніць усе шаблоны пісем для дадзенага часопіса на "
"шаблоны па змоўчанні? Вы згубіце ўсе зробленыя вамі змены."

msgid "manager.website.archiving"
msgstr "Архівацыя"
Loading

0 comments on commit f7931b5

Please sign in to comment.