jenkins-bot has submitted this change and it was merged.

Change subject: Fix course talk notification for deleted pages
......................................................................


Fix course talk notification for deleted pages

This is a temporary fix. Once Echo allows access to revisions of
deleted pages for the 'title' event parameter, it should be
improved.

Bug: 61330
Change-Id: Id450bd57c462f4fa0f0904a6dd93525c087ba97f
---
M includes/notifications/CourseTalkFormatter.php
M includes/notifications/CourseTalkNotification.php
2 files changed, 20 insertions(+), 9 deletions(-)

Approvals:
  Ragesoss: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/notifications/CourseTalkFormatter.php 
b/includes/notifications/CourseTalkFormatter.php
index 6747f7d..65864c3 100644
--- a/includes/notifications/CourseTalkFormatter.php
+++ b/includes/notifications/CourseTalkFormatter.php
@@ -24,14 +24,25 @@
        protected function processParam( $event, $param, $message, $user ) {
                if ( $param === 'short-title-text' ) {
 
-                       // TODO Here we're adding yet another bit of 
unencapsulated code
-                       // that depends on the standard org/course (term) 
format.
-                       // Other patches currently in the pipeline face the 
same issue.
-                       // (See 
https://gerrit.wikimedia.org/r/#/c/98183/6/includes/rows/Course.php)
-                       // Once they're through we can consider a general 
solution.
-                       $fullTitle = $event->getTitle()->getText();
-                       $titleParts = explode( '/', $fullTitle, 2 );
-                       $message->params( $titleParts[1] );
+                       $title = $event->getTitle();
+
+                       // FIXME Temporary measure for deleted pages, improve 
once Echo
+                       // provides revision information for such cases.
+                       if ( !( $title instanceof \Title ) ) {
+
+                               $message->params( '' );
+
+                       } else {
+
+                               // TODO Here we're adding yet another bit of 
unencapsulated code
+                               // that depends on the standard org/course 
(term) format.
+                               // Other patches currently in the pipeline face 
the same issue.
+                               // (See 
https://gerrit.wikimedia.org/r/#/c/98183/6/includes/rows/Course.php)
+                               // Once they're through we can consider a 
general solution.
+                               $fullTitle = $title->getText();
+                               $titleParts = explode( '/', $fullTitle, 2 );
+                               $message->params( $titleParts[1] );
+                       }
 
                } else {
                        parent::processParam( $event, $param, $message, $user );
diff --git a/includes/notifications/CourseTalkNotification.php 
b/includes/notifications/CourseTalkNotification.php
index a179873..e80ba52 100644
--- a/includes/notifications/CourseTalkNotification.php
+++ b/includes/notifications/CourseTalkNotification.php
@@ -105,7 +105,7 @@
 
                $eventParams = array(
                        'type' => CourseTalkNotification::KEY,
-                       'title' => $params['course-talk-title'],
+                       'title' => $title,
                        'agent' => $params['agent'],
                );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id450bd57c462f4fa0f0904a6dd93525c087ba97f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: Ragesoss <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to