Compare commits

...

34 Commits

Author SHA1 Message Date
github-actions 9b79699dcc Merge branch '4.7' into 4 2024-02-11 11:32:58 +00:00
Guy Sartorelli bb3eec1160
TLN Update translations (#223) 2024-02-07 16:03:34 +13:00
github-actions 5f04e466d2 Merge branch '4.7' into 4 2023-08-27 11:32:16 +00:00
Guy Sartorelli 20d61d7d87
ENH Update translations (#208) 2023-08-21 12:13:52 +12:00
Michal Kleiner b6ce505e12 Merge branch '4.7' into 4 2023-06-16 12:09:26 +12:00
Michal Kleiner 9fe83e948d
Merge pull request #201 from silverstripe/pulls/200-use-injector-for-task
MNT Use ::create to allow Injector to replace content review emails sending task
2023-06-16 12:02:44 +12:00
Michal Kleiner 2e22bd4900 MNT Use ::create to allow Injector to replace content review emails sending task 2023-06-16 11:46:30 +12:00
Michal Kleiner 32e7929f01 Merge branch '4.7' into 4 2023-06-16 11:10:50 +12:00
Michal Kleiner 27e0f8f517
Merge pull request #183 from sunnysideup/patch-1
MNT Add additional keywords to composer.json
2023-06-16 10:48:01 +12:00
Guy Sartorelli 72e4321696
Merge pull request #199 from creative-commoners/pulls/4.7/tx-1686724607
ENH Update translations
2023-06-15 10:06:32 +12:00
Steve Boyd b6e00e9528 ENH Update translations 2023-06-14 18:36:47 +12:00
Guy Sartorelli d13bebf999
Merge branch '4.7' into 4 2023-04-26 12:46:27 +12:00
Guy Sartorelli ad33d32066
Merge pull request #195 from creative-commoners/pulls/4.7/fix-broken-job-on-wrong-email
FIX Notification job marked as broken
2023-04-14 12:30:53 +12:00
Sabina Talipova c39e588306 FIX Notification job marked as broken 2023-04-14 12:22:23 +12:00
Guy Sartorelli f9dc2e537d
Merge pull request #192 from creative-commoners/pulls/4/fix-broken-job-on-wrong-email
FIX Notification job marked as broken
2023-04-14 09:40:47 +12:00
Sabina Talipova 36d3718581 ENH Add Exception with list of invilid emails 2023-04-13 10:13:08 +12:00
Sabina Talipova 24766e4e5a FIX Notification job marked as broken 2023-04-12 08:56:49 +12:00
Guy Sartorelli 77bb69f74c
MNT Revert erroneous dependency changes (#191) 2023-03-28 17:06:01 +13:00
Maxime Rainville b5e468a266
Merge pull request #190 from creative-commoners/pulls/4/dispatch-ci
MNT Use gha-dispatch-ci
2023-03-23 14:10:27 +13:00
Steve Boyd f1f6abca67 MNT Use gha-dispatch-ci 2023-03-21 12:23:51 +13:00
Nicolaas / Sunny Side Up 4324836cb7 MNT Add additional keywords to composer.json 2023-03-20 23:21:46 +13:00
Guy Sartorelli 47769763db
MNT Update development dependencies 2023-03-10 16:33:34 +13:00
Guy Sartorelli 884a846167
MNT Update release dependencies 2023-03-10 16:33:31 +13:00
Guy Sartorelli ff723b58ef
MNT Update development dependencies 2023-03-10 12:21:29 +13:00
Guy Sartorelli 18828ed094
Merge pull request #187 from creative-commoners/pulls/4/tx-1678079773
ENH Update translations
2023-03-08 10:25:08 +13:00
Steve Boyd e8a41d96e5 ENH Update translations 2023-03-06 18:16:13 +13:00
dependabot[bot] 179e9d0cf2
Merge pull request #180 from silverstripe/dependabot/npm_and_yarn/debug-2.6.9 2023-01-12 10:25:21 +00:00
dependabot[bot] 48c40a542e
Bump debug from 2.6.8 to 2.6.9
Bumps [debug](https://github.com/debug-js/debug) from 2.6.8 to 2.6.9.
- [Release notes](https://github.com/debug-js/debug/releases)
- [Changelog](https://github.com/debug-js/debug/blob/2.6.9/CHANGELOG.md)
- [Commits](https://github.com/debug-js/debug/compare/2.6.8...2.6.9)

---
updated-dependencies:
- dependency-name: debug
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 10:00:53 +00:00
dependabot[bot] 0b32166a1a
Merge pull request #177 from silverstripe/dependabot/npm_and_yarn/minimatch-3.0.8 2022-12-09 09:50:49 +00:00
dependabot[bot] 013a5c34e7
Bump minimatch from 3.0.4 to 3.0.8
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.0.8.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.0.8)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 08:13:31 +00:00
dependabot[bot] fad0c2b4b4
Merge pull request #176 from silverstripe/dependabot/npm_and_yarn/qs-6.5.3 2022-12-09 08:12:59 +00:00
dependabot[bot] 63024cb902
Bump qs from 6.5.2 to 6.5.3
Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 08:01:04 +00:00
Sabina Talipova a6c7030274
Merge pull request #174 from creative-commoners/pulls/4/stop-using-depr
API Stop using deprecated API
2022-12-05 16:34:50 +13:00
Steve Boyd 6f18e92169 API Stop using deprecated API 2022-11-24 13:04:34 +13:00
14 changed files with 209 additions and 23 deletions

View File

@ -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

16
.github/workflows/dispatch-ci.yml vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -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

11
client/lang/sk.js Normal file
View File

@ -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"
});
}

3
client/lang/src/sk.json Normal file
View File

@ -0,0 +1,3 @@
{
"ContentReview.CONTENT_DUE_FOR_REVIEW": "Obsah určený na kontrolu"
}

View File

@ -7,7 +7,10 @@
"keywords": [
"silverstripe",
"cms",
"workflow"
"workflow",
"content review",
"review",
"permissions"
],
"authors": [
{
@ -49,4 +52,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}

View File

@ -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'

80
lang/sk.yml Normal file
View File

@ -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'

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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
*

View File

@ -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);
}

View File

@ -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"