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

Change subject: Remove non-functional Echo integration
......................................................................


Remove non-functional Echo integration

As far as I can tell, this wouldn't have worked since it was missing
i18n messages and never updated for Echo changes.

Also remove $wgLiquidThreadsNotificationTypes since the whole purpose of
that was to allow using Echo notifications.

Change-Id: Ide9ff9ec369e5d642e90ba4c459beedaf2b66068
---
M LiquidThreads.php
D classes/EchoLiquidThreadsFormatter.php
M classes/Hooks.php
M classes/NewMessagesController.php
M i18n/en.json
M i18n/qqq.json
6 files changed, 0 insertions(+), 178 deletions(-)

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



diff --git a/LiquidThreads.php b/LiquidThreads.php
index 80835e4..6575683 100644
--- a/LiquidThreads.php
+++ b/LiquidThreads.php
@@ -119,7 +119,6 @@
 $wgHooks['SpecialWatchlistQuery'][] = 'LqtHooks::beforeWatchlist';
 $wgHooks['ArticleEditUpdateNewTalk'][] = 'LqtHooks::updateNewtalkOnEdit';
 $wgHooks['PersonalUrls'][] = 'LqtHooks::onPersonalUrls';
-$wgHooks['EchoGetDefaultNotifiedUsers'][] = 
'NewMessages::getDefaultNotifiedUsers';
 
 // Preferences
 $wgHooks['GetPreferences'][] = 'LqtHooks::getPreferences';
@@ -205,7 +204,6 @@
 $wgAutoloadClasses['Thread'] = __DIR__ . '/classes/Thread.php';
 $wgAutoloadClasses['Threads'] = __DIR__ . '/classes/Threads.php';
 $wgAutoloadClasses['NewMessages'] = __DIR__ . 
'/classes/NewMessagesController.php';
-$wgAutoloadClasses['EchoLiquidThreadsFormatter'] = __DIR__. 
"/classes/EchoLiquidThreadsFormatter.php";
 $wgAutoloadClasses['LqtParserFunctions'] = __DIR__ . 
'/classes/ParserFunctions.php';
 $wgAutoloadClasses['LqtDeletionController'] = __DIR__ . 
'/classes/DeletionController.php';
 $wgAutoloadClasses['LqtHooks'] = __DIR__ . '/classes/Hooks.php';
@@ -265,50 +263,6 @@
 $wgAPIModules['feedthreads'] = 'ApiFeedLQTThreads';
 $wgAutoloadClasses['ApiThreadAction'] = __DIR__ . '/api/ApiThreadAction.php';
 $wgAPIModules['threadaction'] = 'ApiThreadAction';
-
-// Whether or not to use the standard LiquidThreads notifications
-$wgLiquidThreadsNotificationTypes = array( 'standard' );
-
-// Echo
-$wgExtensionFunctions[] = 'wfLiquidThreadsSetupEcho';
-
-function wfLiquidThreadsSetupEcho() {
-       // LiquidThreads echo notifications have not been fully tested,
-       // turn it off temporarily till expected behaviors are verified
-       /*
-       global $wgLiquidThreadsNotificationTypes;
-       global $wgEchoNotificationFormatters;
-       global $wgEchoEnabledEvents;
-
-       if ( isset( $wgEchoNotificationFormatters ) ) {
-               $wgLiquidThreadsNotificationTypes = array( 'echo' );
-
-               $wgEchoNotificationFormatters += array(
-                       'lqt-new-topic' => array(
-                               'class' => 'EchoLiquidThreadsFormatter',
-                               'title-message' => 
'notification-add-talkpage-topic',
-                               'title-params' => array( 'agent', 'subject', 
'title', 'content-page' ),
-                               'content-message' => 
'notification-talkpage-content',
-                               'content-params' => array( 'commentText' ),
-                               'icon' => 'chat',
-                       ),
-                       'lqt-reply' => array(
-                               'class' => 'EchoLiquidThreadsFormatter',
-                               'title-message' => 'notification-add-comment',
-                               'title-params' => array( 'agent', 'subject', 
'title', 'content-page' ),
-                               'content-message' => 
'notification-talkpage-content',
-                               'content-params' => array( 'commentText' ),
-                               'icon' => 'chat',
-                       ),
-               );
-
-               $wgEchoEnabledEvents = array_merge( $wgEchoEnabledEvents, array(
-                       'lqt-new-topic',
-                       'lqt-reply',
-               ) );
-       }
-       */
-}
 
 // Path to the LQT directory
 $wgLiquidThreadsExtensionPath = "{$wgScriptPath}/extensions/LiquidThreads";
diff --git a/classes/EchoLiquidThreadsFormatter.php 
b/classes/EchoLiquidThreadsFormatter.php
deleted file mode 100644
index d7c478c..0000000
--- a/classes/EchoLiquidThreadsFormatter.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-class EchoLiquidThreadsFormatter extends EchoBasicFormatter {
-       protected function processParam( $event, $param, $message, $user ) {
-               $extra = $event->getExtra();
-               if ( $param === 'subject' ) {
-                       $thread = $this->getThread( $event );
-                       if ( $thread ) {
-                               $message->params( $thread->subject() );
-                       } else {
-                               $message->params( '' );
-                       }
-               } elseif ( $param === 'commentText' ) {
-                       global $wgLang; // Message::language is protected :(
-
-                       $thread = $this->getThread( $event );
-                       if ( $thread ) {
-                               $content = EchoDiscussionParser::stripHeader( 
$thread->root()->getContent() );
-                               $content = $wgLang->truncate( $content, 200 );
-
-                               $message->params( $content );
-                       } else {
-                               $message->params( '' );
-                       }
-               } elseif ( $param === 'content-page' ) {
-                       if ( $event->getTitle() ) {
-                               $message->params( 
$event->getTitle()->getSubjectPage()->getPrefixedText() );
-                       } else {
-                               $message->params( '' );
-                       }
-               } else {
-                       parent::processParam( $event, $param, $message, $user );
-               }
-       }
-
-       protected function getThread( $event ) {
-               $extra = $event->getExtra();
-               if ( !$extra || !$extra['thread'] ) {
-                       return true;
-               }
-
-               $thread = Threads::withId( $extra['thread'] );
-
-               return $thread;
-       }
-}
diff --git a/classes/Hooks.php b/classes/Hooks.php
index acb68ed..07ff3d5 100644
--- a/classes/Hooks.php
+++ b/classes/Hooks.php
@@ -81,12 +81,6 @@
                        return true;
                }
 
-               global $wgLiquidThreadsNotificationTypes;
-
-               if ( ! in_array( 'standard', $wgLiquidThreadsNotificationTypes 
) ) {
-                       return true;
-               }
-
                $pageTitle = $skintemplate->getTitle();
                $newmsg_t = SpecialPage::getTitleFor( 'NewMessages' );
                $watchlist_t = SpecialPage::getTitleFor( 'Watchlist' );
@@ -506,12 +500,6 @@
                global $wgUser;
 
                if ( $wgUser->isAnon() ) {
-                       return true;
-               }
-
-               global $wgLiquidThreadsNotificationTypes;
-
-               if ( ! in_array( 'standard', $wgLiquidThreadsNotificationTypes 
) ) {
                        return true;
                }
 
diff --git a/classes/NewMessagesController.php 
b/classes/NewMessagesController.php
index f16d7d1..b59d262 100644
--- a/classes/NewMessagesController.php
+++ b/classes/NewMessagesController.php
@@ -142,18 +142,6 @@
        static function writeMessageStateForUpdatedThread( $t, $type, 
$changeUser ) {
                wfDebugLog( 'LiquidThreads', 'Doing notifications' );
 
-               global $wgLiquidThreadsNotificationTypes;
-
-               if (    class_exists( 'EchoEvent' ) &&
-                       in_array( 'echo', $wgLiquidThreadsNotificationTypes )
-               ) {
-                       self::doEchoNotifications( $t, $type, $changeUser );
-               }
-
-               if ( ! in_array( 'standard', $wgLiquidThreadsNotificationTypes 
) ) {
-                       return;
-               }
-
                $usersByCategory = self::getNotifyUsers( $t, $changeUser );
                $userIds = $usersByCategory['notify'];
                $notifyUsers = $usersByCategory['email'];
@@ -231,64 +219,6 @@
                        'notify' => $userIds,
                        'email' => $notifyUsers,
                );
-       }
-
-       /**
-        * Distribute Echo notifications for a change
-        *
-        * @param $thread The Thread object in question.
-        * @param $type The change_type (see constants in Threads)
-        * @param $changeUser the User who made the change
-        * @return null
-        */
-       static function doEchoNotifications( $thread, $type, $changeUser ) {
-               $events = array(
-                       Threads::CHANGE_REPLY_CREATED => 'lqt-reply',
-                       Threads::CHANGE_NEW_THREAD => 'lqt-new-topic',
-               );
-
-               foreach ( $events as $change_type => $event_type ) {
-                       if ( $type == $change_type ) {
-                               EchoEvent::create( array(
-                                       'type' => $event_type,
-                                       'title' => 
$thread->article()->getTitle(),
-                                       'agent' => $changeUser,
-                                       'extra' => array(
-                                               'thread' => $thread->id(),
-                                               'subject' => $thread->subject(),
-                                               'root' => 
$thread->root()->getTitle()->getPrefixedText(),
-                                       ),
-                               ) );
-                       }
-               }
-       }
-
-       public static function getDefaultNotifiedUsers( $event, &$users ) {
-               $type = $event->getType();
-               $lqtEvents = array( 'lqt-reply', 'lqt-new-topic' );
-
-               if ( ! in_array( $type, $lqtEvents ) ) {
-                       return true;
-               }
-
-               $extra = $event->getExtra();
-               if ( !$extra || !$extra['thread'] ) {
-                       return true;
-               }
-
-               $thread = Threads::withId( $extra['thread'] );
-
-               if ( ! $thread ) {
-                       return true;
-               }
-
-               $targets = self::getNotifyUsers( $thread, $event->getAgent() );
-
-               foreach ( $targets['notify'] as $uid ) {
-                       $users[$uid] = User::newFromId( $uid );
-               }
-
-               return true;
        }
 
        // Would refactor User::decodeOptions, but the whole point is that this 
is
diff --git a/i18n/en.json b/i18n/en.json
index 89b05d4..567f46f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -237,8 +237,6 @@
        "lqt-pagechange-editformopen": "You have unsaved text open on this 
page. You may lose it if you go away from this page.",
        "nstab-thread": "Thread",
        "nstab-summary": "Summary",
-       "echo-pref-email-lqt-new-topic": "Creates a new threaded discussion",
-       "echo-pref-email-lqt-reply": "Replies to a threaded discussion",
        "pageinfo-usinglqt": "Threaded discussion enabled",
        "pageinfo-usinglqt-yes": "Yes",
        "apihelp-feedthreads-description": "Return a feed of discussion 
threads.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 99b9db5..493ab18 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -214,8 +214,6 @@
        "lqt-pagechange-editformopen": "Shown as a JavaScript confirmation 
dialog to the user when they try to leave the page while an LQT editing form is 
open.",
        "nstab-thread": "Used as tab title of the Thread 
namespace.\n{{Identical|Thread}}",
        "nstab-summary": "Used as tab title for the Summary 
namespace.\n{{Identical|Summary}}",
-       "echo-pref-email-lqt-new-topic": "Used by the Echo extension in the 
Preferences -> Notifications tab as a label to enable email notification for 
the lqt-new-topic event.",
-       "echo-pref-email-lqt-reply": "Used by the Echo extension in the 
Preferences -> Notifications tab as a label to enable email notification for 
the lqt-reply event.",
        "pageinfo-usinglqt": "Entry for whether the page uses LiquidThreads or 
not",
        "pageinfo-usinglqt-yes": "Yes, this page uses 
LiquidThreads.\n{{Identical|Yes}}",
        "apihelp-feedthreads-description": 
"{{doc-apihelp-description|feedthreads}}",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide9ff9ec369e5d642e90ba4c459beedaf2b66068
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to