Compare commits
34 Commits
4.6.0-beta
...
4
Author | SHA1 | Date |
---|---|---|
github-actions | 9b79699dcc | |
Guy Sartorelli | bb3eec1160 | |
github-actions | 5f04e466d2 | |
Guy Sartorelli | 20d61d7d87 | |
Michal Kleiner | b6ce505e12 | |
Michal Kleiner | 9fe83e948d | |
Michal Kleiner | 2e22bd4900 | |
Michal Kleiner | 32e7929f01 | |
Michal Kleiner | 27e0f8f517 | |
Guy Sartorelli | 72e4321696 | |
Steve Boyd | b6e00e9528 | |
Guy Sartorelli | d13bebf999 | |
Guy Sartorelli | ad33d32066 | |
Sabina Talipova | c39e588306 | |
Guy Sartorelli | f9dc2e537d | |
Sabina Talipova | 36d3718581 | |
Sabina Talipova | 24766e4e5a | |
Guy Sartorelli | 77bb69f74c | |
Maxime Rainville | b5e468a266 | |
Steve Boyd | f1f6abca67 | |
Nicolaas / Sunny Side Up | 4324836cb7 | |
Guy Sartorelli | 47769763db | |
Guy Sartorelli | 884a846167 | |
Guy Sartorelli | ff723b58ef | |
Guy Sartorelli | 18828ed094 | |
Steve Boyd | e8a41d96e5 | |
dependabot[bot] | 179e9d0cf2 | |
dependabot[bot] | 48c40a542e | |
dependabot[bot] | 0b32166a1a | |
dependabot[bot] | 013a5c34e7 | |
dependabot[bot] | fad0c2b4b4 | |
dependabot[bot] | 63024cb902 | |
Sabina Talipova | a6c7030274 | |
Steve Boyd | 6f18e92169 |
|
@ -4,13 +4,8 @@ on:
|
|||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
# Every Wednesday at 11:30am UTC
|
||||
schedule:
|
||||
- cron: '30 11 * * 3'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: CI
|
||||
# Only run cron on the silverstripe account
|
||||
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
name: Dispatch CI
|
||||
|
||||
on:
|
||||
# At 11:30 AM UTC, only on Wednesday and Thursday
|
||||
schedule:
|
||||
- cron: '30 11 * * 3,4'
|
||||
|
||||
jobs:
|
||||
dispatch-ci:
|
||||
name: Dispatch CI
|
||||
# Only run cron on the silverstripe account
|
||||
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Dispatch CI
|
||||
uses: silverstripe/gha-dispatch-ci@v1
|
|
@ -1,14 +1,15 @@
|
|||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[silverstripe-contentreview.master]
|
||||
[o:silverstripe:p:silverstripe-contentreview:r:master]
|
||||
file_filter = lang/<lang>.yml
|
||||
source_file = lang/en.yml
|
||||
source_lang = en
|
||||
type = YML
|
||||
type = YML
|
||||
|
||||
[silverstripe-contentreview.master-js]
|
||||
[o:silverstripe:p:silverstripe-contentreview:r:master-js]
|
||||
file_filter = client/lang/src/<lang>.json
|
||||
source_file = client/lang/src/en.json
|
||||
source_lang = en
|
||||
type = KEYVALUEJSON
|
||||
type = KEYVALUEJSON
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// This file was generated by silverstripe/cow from client/lang/src/en.json.
|
||||
// See https://github.com/silverstripe/cow for details
|
||||
// This file was generated by silverstripe/tx-translator from client/lang/src/en.json.
|
||||
// See https://github.com/silverstripe/silverstripe-tx-translator for details
|
||||
if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
|
||||
if (typeof(console) !== 'undefined') { // eslint-disable-line no-console
|
||||
console.error('Class ss.i18n not defined'); // eslint-disable-line no-console
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// This file was generated by silverstripe/tx-translator from client/lang/src/sk.json.
|
||||
// See https://github.com/silverstripe/silverstripe-tx-translator for details
|
||||
if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
|
||||
if (typeof(console) !== 'undefined') { // eslint-disable-line no-console
|
||||
console.error('Class ss.i18n not defined'); // eslint-disable-line no-console
|
||||
}
|
||||
} else {
|
||||
ss.i18n.addDictionary('sk', {
|
||||
"ContentReview.CONTENT_DUE_FOR_REVIEW": "Obsah určený na kontrolu"
|
||||
});
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"ContentReview.CONTENT_DUE_FOR_REVIEW": "Obsah určený na kontrolu"
|
||||
}
|
|
@ -7,7 +7,10 @@
|
|||
"keywords": [
|
||||
"silverstripe",
|
||||
"cms",
|
||||
"workflow"
|
||||
"workflow",
|
||||
"content review",
|
||||
"review",
|
||||
"permissions"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
|
@ -49,4 +52,4 @@
|
|||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
19
lang/en.yml
19
lang/en.yml
|
@ -15,6 +15,14 @@ en:
|
|||
PAGEOWNERUSERS: Users
|
||||
REVIEWFREQUENCY: 'Review frequency'
|
||||
REVIEWFREQUENCYDESCRIPTION: 'The review date will be set to this far in the future, whenever the page is published.'
|
||||
db_ReviewBody: 'Review body'
|
||||
db_ReviewFrom: 'Review from'
|
||||
db_ReviewPeriodDays: 'Review period days'
|
||||
db_ReviewSubject: 'Review subject'
|
||||
many_many_ContentReviewGroups: 'Content review groups'
|
||||
many_many_ContentReviewUsers: 'Content review users'
|
||||
SilverStripe\ContentReview\Extensions\ContentReviewOwner:
|
||||
many_many_SiteTreeContentReview: 'Site tree content review'
|
||||
SilverStripe\ContentReview\Extensions\SiteTreeContentReview:
|
||||
ADDGROUP: 'Add groups'
|
||||
ADDUSERS: 'Add users'
|
||||
|
@ -34,6 +42,14 @@ en:
|
|||
REVIEWFREQUENCYDESCRIPTION: 'The review date will be set to this far in the future whenever the page is published'
|
||||
REVIEWHEADER: 'Content review'
|
||||
SETTINGSFROM: 'Options are'
|
||||
belongs_many_many_ContentReviewGroups: 'Content review groups'
|
||||
belongs_many_many_ContentReviewUsers: 'Content review users'
|
||||
db_ContentReviewType: 'Content review type'
|
||||
db_LastEditedByName: 'Last edited by name'
|
||||
db_NextReviewDate: 'Next review date'
|
||||
db_OwnerNames: 'Owner names'
|
||||
db_ReviewPeriodDays: 'Review period days'
|
||||
has_many_ReviewLogs: 'Review logs'
|
||||
SilverStripe\ContentReview\Forms\ReviewContentHandler:
|
||||
ErrorReviewPermissionDenied: 'It seems you don''t have the necessary permissions to submit a content review'
|
||||
MarkAsReviewedAction: 'Mark as reviewed'
|
||||
|
@ -46,6 +62,9 @@ en:
|
|||
one: 'A Content Review Log'
|
||||
other: '{count} Content Review Logs'
|
||||
SINGULARNAME: 'Content Review Log'
|
||||
db_Note: Note
|
||||
has_one_Reviewer: Reviewer
|
||||
has_one_SiteTree: 'Site tree'
|
||||
SilverStripe\ContentReview\Reports\PagesDueForReviewReport:
|
||||
ONLYMYPAGES: 'Only Show pages assigned to me'
|
||||
REVIEWDATEAFTER: 'Review date after or on'
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
sk:
|
||||
SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension:
|
||||
ErrorItemPermissionDenied: 'Zdá sa, že nemáte potrebné oprávnenia na kontrolu tohto obsahu'
|
||||
SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings:
|
||||
ADDGROUP: 'Pridať skupiny'
|
||||
ADDUSERS: 'Pridať používateľov'
|
||||
DEFAULTSETTINGSHELP: 'Tieto nastavenia sa použijú na všetky stránky, ktoré nemajú špecifický plán kontroly obsahu.'
|
||||
EMAILFROM: 'Z e-mailovej adresy'
|
||||
EMAILFROM_RIGHTTITLE: 'napr.: do-not-reply@site.com'
|
||||
EMAILSUBJECT: Predmet
|
||||
EMAILTEMPLATE: 'Šablóna e-mailu'
|
||||
OWNERGROUPSDESCRIPTION: 'Vlastníci stránok, ktorí sú zodpovední za kontrolu'
|
||||
OWNERUSERSDESCRIPTION: 'Vlastníci stránok, ktorí sú zodpovední za kontrolu'
|
||||
PAGEOWNERGROUPS: Skupiny
|
||||
PAGEOWNERUSERS: Používatelia
|
||||
REVIEWFREQUENCY: 'Frekvencia kontroly'
|
||||
REVIEWFREQUENCYDESCRIPTION: 'Dátum kontroly bude nastavený na tento dátum v budúcnosti, bez ohľadu na to, kedy bude stránka zverejnená.'
|
||||
db_ReviewBody: 'Revízny orgán'
|
||||
db_ReviewFrom: 'Kontrola od'
|
||||
db_ReviewPeriodDays: 'Dni periódy kontroly'
|
||||
db_ReviewSubject: 'Predmet kontroly'
|
||||
many_many_ContentReviewGroups: 'Skupiny kontroly obsahu'
|
||||
many_many_ContentReviewUsers: 'Používatelia kontroly obsahu'
|
||||
SilverStripe\ContentReview\Extensions\ContentReviewOwner:
|
||||
many_many_SiteTreeContentReview: 'Kontrola obsahu stromu stránok'
|
||||
SilverStripe\ContentReview\Extensions\SiteTreeContentReview:
|
||||
ADDGROUP: 'Pridať skupiny'
|
||||
ADDUSERS: 'Pridať používateľov'
|
||||
CONTENTOWNERS: 'Vlastníci obsahu'
|
||||
CONTENTREVIEW: 'Obsah určený na kontrolu'
|
||||
CUSTOM: 'Vlastné nastavenia'
|
||||
DISABLE: 'Zakázať kontrolu obsahu'
|
||||
INHERIT: 'Zdediť z nadradenej stránky'
|
||||
NEXTREVIEWDATADESCRIPTION: 'Ak nechcete vyplniť kontrolu, ponechajte pole prázdne'
|
||||
NEXTREVIEWDATE: 'Dátum ďalšej kontroly'
|
||||
OPTIONS: Možnosti
|
||||
OWNERGROUPSDESCRIPTION: 'Vlastníci stránok, ktorí sú zodpovední za kontrolu'
|
||||
OWNERUSERSDESCRIPTION: 'Vlastníci stránok, ktorí sú zodpovední za kontrolu'
|
||||
PAGEOWNERGROUPS: Skupiny
|
||||
PAGEOWNERUSERS: Používatelia
|
||||
REVIEWFREQUENCY: 'Frekvencia kontroly'
|
||||
REVIEWFREQUENCYDESCRIPTION: 'Dátum kontroly bude nastavený na tento dátum v budúcnosti, bez ohľadu na to, kedy bude stránka zverejnená.'
|
||||
REVIEWHEADER: 'Kontrola obsahu'
|
||||
SETTINGSFROM: 'Možnosti sú'
|
||||
belongs_many_many_ContentReviewGroups: 'Skupiny kontroly obsahu'
|
||||
belongs_many_many_ContentReviewUsers: 'Používatelia kontroly obsahu'
|
||||
db_ContentReviewType: 'Typ kontroly obsahu'
|
||||
db_LastEditedByName: 'Naposledy upravené podľa mena'
|
||||
db_NextReviewDate: 'Dátum ďalšej kontroly'
|
||||
db_OwnerNames: 'Mená vlastníkov'
|
||||
db_ReviewPeriodDays: 'Dni periódy kontroly'
|
||||
has_many_ReviewLogs: 'Záznamy z kontroly'
|
||||
SilverStripe\ContentReview\Forms\ReviewContentHandler:
|
||||
ErrorReviewPermissionDenied: 'Zdá sa, že nemáte potrebné oprávnenia na odoslanie kontroly obsahu'
|
||||
MarkAsReviewedAction: 'Označiť ako skontrolované'
|
||||
NoComments: '(bez komentára)'
|
||||
Placeholder: 'Pridať komentáre (voliteľné)'
|
||||
Success: 'Kontrola bola úspešne pridaná'
|
||||
SilverStripe\ContentReview\Models\ContentReviewLog:
|
||||
PLURALNAME: 'Záznamy z kontroly obsahu'
|
||||
PLURALS:
|
||||
few: '{count} záznamy z kontroly obsahu'
|
||||
many: '{count} záznamov z kontroly obsahu'
|
||||
one: 'Záznam z kontroly obsahu'
|
||||
other: '{count} záznamov z kontroly obsahu'
|
||||
SINGULARNAME: 'Záznam z kontroly obsahu'
|
||||
db_Note: Poznámka
|
||||
has_one_Reviewer: Kontrolór
|
||||
has_one_SiteTree: 'Strom stránok'
|
||||
SilverStripe\ContentReview\Reports\PagesDueForReviewReport:
|
||||
ONLYMYPAGES: 'Zobraziť iba mne priradené stránky'
|
||||
REVIEWDATEAFTER: 'Dátum kontroly po'
|
||||
REVIEWDATEBEFORE: 'Dátum kontroly pred'
|
||||
SHOWVIRTUALPAGES: 'Zobraziť virtuálne stránky'
|
||||
TITLE: 'Stránky určené na kontrolu'
|
||||
SilverStripe\ContentReview\Reports\PagesWithoutReviewScheduleReport:
|
||||
TITLE: 'Stránky bez naplánovanej kontroly.'
|
||||
SilverStripe\ContentReview\Tasks\ContentReviewEmails:
|
||||
REVIEWPAGELINK: 'Skontrolujte stránku v CMS'
|
||||
VIEWPUBLISHEDLINK: 'Pozrite si túto stránku na webe'
|
|
@ -93,7 +93,7 @@ class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJo
|
|||
{
|
||||
$this->queueNextRun();
|
||||
|
||||
$task = new ContentReviewEmails();
|
||||
$task = ContentReviewEmails::create();
|
||||
$task->run(new HTTPRequest("GET", "/dev/tasks/ContentReviewEmails"));
|
||||
|
||||
$this->currentStep = 1;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace SilverStripe\ContentReview\Tasks;
|
||||
|
||||
use Page;
|
||||
use RuntimeException;
|
||||
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
|
||||
use SilverStripe\Control\Email\Email;
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
|
@ -15,18 +16,29 @@ use SilverStripe\Security\Member;
|
|||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\View\ArrayData;
|
||||
use SilverStripe\View\SSViewer;
|
||||
use SilverStripe\ContentReview\Models\ContentReviewLog;
|
||||
|
||||
/**
|
||||
* Daily task to send emails to the owners of content items when the review date rolls around.
|
||||
*/
|
||||
class ContentReviewEmails extends BuildTask
|
||||
{
|
||||
private array $invalid_emails = [];
|
||||
|
||||
/**
|
||||
* @param HTTPRequest $request
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function run($request)
|
||||
{
|
||||
if (!$this->isValidEmail($senderEmail = SiteConfig::current_site_config()->ReviewFrom)) {
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Provided sender email address is invalid: "%s".',
|
||||
$senderEmail
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$compatibility = ContentReviewCompatability::start();
|
||||
|
||||
// First grab all the pages with a custom setting
|
||||
|
@ -42,6 +54,16 @@ class ContentReviewEmails extends BuildTask
|
|||
}
|
||||
|
||||
ContentReviewCompatability::done($compatibility);
|
||||
|
||||
if (is_array($this->invalid_emails) && count($this->invalid_emails) > 0) {
|
||||
$plural = count($this->invalid_emails) > 1 ? 's are' : ' is';
|
||||
throw new RuntimeException(
|
||||
sprintf(
|
||||
'Provided email' . $plural . ' invalid: "%s".',
|
||||
implode(', ', $this->invalid_emails)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,6 +115,13 @@ class ContentReviewEmails extends BuildTask
|
|||
// Prepare variables
|
||||
$siteConfig = SiteConfig::current_site_config();
|
||||
$owner = Member::get()->byID($ownerID);
|
||||
|
||||
if (!$this->isValidEmail($owner->Email)) {
|
||||
$this->invalid_emails[] = $owner->Name . ': ' . $owner->Email;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$templateVariables = $this->getTemplateVariables($owner, $siteConfig, $pages);
|
||||
|
||||
// Build email
|
||||
|
@ -159,4 +188,12 @@ class ContentReviewEmails extends BuildTask
|
|||
'ToEmail' => $recipient->Email,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check validity of email
|
||||
*/
|
||||
protected function isValidEmail(?string $email): bool
|
||||
{
|
||||
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace SilverStripe\ContentReview\Tests;
|
||||
|
||||
use Page;
|
||||
use ReflectionClass;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
|
||||
|
@ -132,6 +133,26 @@ class ContentReviewNotificationTest extends SapphireTest
|
|||
DBDatetime::clear_mock_now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that provided email is valid
|
||||
*/
|
||||
public function testIsValidEmail()
|
||||
{
|
||||
$class = new ReflectionClass(ContentReviewEmails::class);
|
||||
$method = $class->getMethod('isValidEmail');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$member = $this->objFromFixture(Member::class, 'author');
|
||||
$task = new ContentReviewEmails();
|
||||
|
||||
$this->assertTrue($method->invokeArgs($task, [$member->Email]));
|
||||
$this->assertTrue($method->invokeArgs($task, ['correct.email@example.com']));
|
||||
|
||||
$this->assertFalse($method->invokeArgs($task, [null]));
|
||||
$this->assertFalse($method->invokeArgs($task, ['broken.email']));
|
||||
$this->assertFalse($method->invokeArgs($task, ['broken@email']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all pages except those passes in to the $ids parameter
|
||||
*
|
||||
|
|
|
@ -55,7 +55,7 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
|
|||
$page->write();
|
||||
|
||||
$this->assertTrue($page->canPublish());
|
||||
$this->assertTrue($page->doPublish());
|
||||
$this->assertTrue($page->publishRecursive());
|
||||
$this->assertEquals($page->OwnerNames, "Test Editor", "Test Editor should be the owner");
|
||||
|
||||
/** @var Page|SiteTreeContentReview $page */
|
||||
|
@ -119,7 +119,7 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
|
|||
$page->ReviewPeriodDays = 10;
|
||||
$page->write();
|
||||
|
||||
$this->assertTrue($page->doPublish());
|
||||
$this->assertTrue($page->publishRecursive());
|
||||
$this->assertEquals(null, $page->NextReviewDate);
|
||||
}
|
||||
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -1392,8 +1392,8 @@ date-now@^0.1.4:
|
|||
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
|
||||
|
||||
debug@^2.1.1, debug@^2.2.0, debug@^2.6.8:
|
||||
version "2.6.8"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
|
@ -2860,8 +2860,8 @@ minimalistic-crypto-utils@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
|
||||
|
||||
minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4, minimatch@~3.0.2:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
version "3.0.8"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1"
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
|
@ -3650,8 +3650,8 @@ q@^1.1.2:
|
|||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
|
||||
|
||||
qs@~6.5.2:
|
||||
version "6.5.2"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
version "6.5.3"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad"
|
||||
|
||||
query-string@^4.1.0:
|
||||
version "4.3.4"
|
||||
|
|
Loading…
Reference in New Issue