mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge branch '2'
This commit is contained in:
commit
84ac94f818
1
.codecov.yml
Normal file
1
.codecov.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
comment: false
|
15
docs/en/configuring-notifications.md
Normal file
15
docs/en/configuring-notifications.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Configuring notifications
|
||||||
|
|
||||||
|
## Configuring whether notifications will send to authors of blogs if comments are spam
|
||||||
|
|
||||||
|
Default behaviour using the `silverstripe/comment-notifications` module is to send notification to authors of comments occuring regardless if they are spam or not.
|
||||||
|
|
||||||
|
In some cases you may wish to not send a notification email to an author if the comment is spam, this is a configurable option.
|
||||||
|
|
||||||
|
Add the following into your yaml config:
|
||||||
|
|
||||||
|
```
|
||||||
|
BlogPostNotifications:
|
||||||
|
notification_on_spam: false
|
||||||
|
```
|
||||||
|
|
@ -109,11 +109,11 @@ class BlogMemberExtension extends DataExtension
|
|||||||
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||||
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
|
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
|
||||||
|
|
||||||
$tab = Tab::create('BlogPosts', 'Blog Posts');
|
$tab = Tab::create('BlogPosts', _t('BlogMemberExtension.TABBLOGPOSTS', 'Blog Posts'));
|
||||||
|
|
||||||
$gridField = GridField::create(
|
$gridField = GridField::create(
|
||||||
'BlogPosts',
|
'BlogPosts',
|
||||||
'Blog Posts',
|
_t('BlogMemberExtension.BLOGPOSTS', 'Blog Posts'),
|
||||||
$this->owner->BlogPosts(),
|
$this->owner->BlogPosts(),
|
||||||
GridFieldConfig_BlogPost::create()
|
GridFieldConfig_BlogPost::create()
|
||||||
);
|
);
|
||||||
|
@ -31,7 +31,7 @@ class BlogPostFilter extends DataExtension
|
|||||||
{
|
{
|
||||||
$stage = Versioned::get_stage();
|
$stage = Versioned::get_stage();
|
||||||
|
|
||||||
if (Controller::curr() instanceof LeftAndMain) {
|
if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,12 @@ use SilverStripe\ORM\DataExtension;
|
|||||||
*/
|
*/
|
||||||
class BlogPostNotifications extends DataExtension
|
class BlogPostNotifications extends DataExtension
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Configure whether to send notifications even for spam comments
|
||||||
|
* @config
|
||||||
|
*/
|
||||||
|
private static $notification_on_spam = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify all authors of notifications.
|
* Notify all authors of notifications.
|
||||||
*
|
*
|
||||||
@ -19,7 +25,13 @@ class BlogPostNotifications extends DataExtension
|
|||||||
*/
|
*/
|
||||||
public function updateNotificationRecipients(&$list, &$comment)
|
public function updateNotificationRecipients(&$list, &$comment)
|
||||||
{
|
{
|
||||||
|
//default is notification is on regardless of spam status
|
||||||
$list = $this->owner->Authors();
|
$list = $this->owner->Authors();
|
||||||
|
|
||||||
|
// If comment is spam and notification are set to not send on spam clear the recipient list
|
||||||
|
if (Config::inst()->get(__CLASS__, 'notification_on_spam') == false && $comment->IsSpam) {
|
||||||
|
$list = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user