Robert Vogel has submitted this change and it was merged.

Change subject: added hook for additional actions, added notifications
......................................................................


added hook for additional actions, added notifications

Change-Id: I830d3059794aac439cfaad5be165efc5185ed6f3
---
M ResponsibleEditors/ResponsibleEditors.class.php
1 file changed, 31 insertions(+), 8 deletions(-)

Approvals:
  Robert Vogel: Verified; Looks good to me, approved



diff --git a/ResponsibleEditors/ResponsibleEditors.class.php 
b/ResponsibleEditors/ResponsibleEditors.class.php
index 01b46b1..d3ff67b 100644
--- a/ResponsibleEditors/ResponsibleEditors.class.php
+++ b/ResponsibleEditors/ResponsibleEditors.class.php
@@ -878,7 +878,8 @@
                $sUserName    = BsExtensionManager::getExtension( 
'ResponsibleEditors' )->mCore->getUserDisplayName( $oUser );
                $sArticleName = $aTitles[0]->getText();
                $sArticleLink = $aTitles[0]->getFullURL();
-
+               $sSubject = "";
+               $sMessage = "";
                switch( $sAction ) {
                        case 'change':
                                $sSubject = wfMessage(
@@ -921,14 +922,36 @@
                                )->plain();
                                break;
                        default:
-                               wfDebugLog(
-                                       
'BS::ResponsibleEditors::notifyResponsibleEditors',
-                                       'Action "'.$sAction.'" is unknown. No 
mails sent.'
-                               );
-                               return;
+                               $bResult = 
wfRunHooks("BsResponsibleEditorsnotifyResponsibleEditorUnknownAction", 
array(&$aResponsibleEditors, $oUser, &$aTitles[0], &$sAction, &$sSubject, 
&$sMessage));
+                               if ($sSubject == "" || $sMessage == "" || 
$bResult === false){
+                                       wfDebugLog(
+                                               'BS::ResponsibleEditors',
+                                               'Error in 
notifyResponsibleEditors, action "'.$sAction.'" is unknown. No mails sent.'
+                                       );
+                                       return;
+                               }
                }
-
-               BsMailer::getInstance('MW')->send($aResponsibleEditors, 
$sSubject, $sMessage);
+               if (class_exists('Echo')){
+                       foreach ($aResponsibleEditors as $oReUser){
+                               if ($sAction == "change")
+                                       $sAction = "edit";
+                               EchoEvent::create( array(
+                                       'type'  => 'bs-' . $sAction,
+                                       'title' => $aTitles[0],
+                                       'agent' => $oUser,
+                                       'extra' => array(
+                                                       'summary'   => "",
+                                                       'titlelink' => true,
+                                                       'difflink'  => array( 
'diffparams' => array() ),
+                                                       'agentlink' => true,
+                                                       'responsible-editor-id' 
=> $oReUser->getId()
+                                               ),
+                               ) );
+                       }
+               }
+               else{
+                       BsMailer::getInstance('MW')->send($aResponsibleEditors, 
$sSubject, $sMessage);
+               }
        }
 
        public static function getResponsibleEditorsPortletData( $iCount, 
$iUserId ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/176935
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I830d3059794aac439cfaad5be165efc5185ed6f3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_22
Gerrit-Owner: Tweichart <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pigpen <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Smuggli <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to