Tweichart has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176935

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, 30 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/35/176935/1

diff --git a/ResponsibleEditors/ResponsibleEditors.class.php 
b/ResponsibleEditors/ResponsibleEditors.class.php
index 01b46b1..17155cf 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,35 @@
                                )->plain();
                                break;
                        default:
-                               wfDebugLog(
-                                       
'BS::ResponsibleEditors::notifyResponsibleEditors',
-                                       'Action "'.$sAction.'" is unknown. No 
mails sent.'
-                               );
-                               return;
+                               
wfRunHooks("BsResponsibleEditorsnotifyResponsibleEditorUnknownAction", 
array(&$aResponsibleEditors, $oUser, &$aTitles[0], &$sAction, &$sSubject, 
&$sMessage));
+                               if ($sSubject == "" || $sMessage == ""){
+                                       wfDebugLog(
+                                               
'BS::ResponsibleEditors::notifyResponsibleEditors',
+                                               'Action "'.$sAction.'" is 
unknown. No mails sent.'
+                                       );
+                                       return;
+                               }
                }
-
-               BsMailer::getInstance('MW')->send($aResponsibleEditors, 
$sSubject, $sMessage);
+               if (class_exists('Notifications')){
+                       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: newchange
Gerrit-Change-Id: I830d3059794aac439cfaad5be165efc5185ed6f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_22
Gerrit-Owner: Tweichart <[email protected]>

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

Reply via email to