Bmansurov has uploaded a new change for review.

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

Change subject: Remove SpecialMobileNotifications
......................................................................

Remove SpecialMobileNotifications

The Special:Notifications page on mobile has render issues and doesn't
seem to solve any problem. Let the code be improved in Echo.

Bug: T112189
Bug: T112191
Change-Id: I7bc41aca5965bab419349b25f1b04349282ef849
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
M includes/Resources.php
D includes/specials/SpecialMobileNotifications.php
D resources/mobile.special.notifications.scripts/notifications.js
D resources/mobile.special.notifications.styles/notifications.less
6 files changed, 0 insertions(+), 227 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/83/238083/1

diff --git a/MobileFrontend.php b/MobileFrontend.php
index 8b79add..123142b 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -83,7 +83,6 @@
        'SpecialNearby' => 'specials/SpecialNearby',
        'SpecialMobileLanguages' => 'specials/SpecialMobileLanguages',
        'SpecialMobilePreferences' => 'specials/SpecialMobilePreferences',
-       'SpecialMobileNotifications' => 'specials/SpecialMobileNotifications',
        'SpecialTopicTag' => 'specials/browse/SpecialTopicTag',
        'MobileSpecialPage' => 'specials/MobileSpecialPage',
        'MobileSpecialPageFeed' => 'specials/MobileSpecialPageFeed',
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 811e8e2..fca44fa 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -389,10 +389,6 @@
                         * Special:Contributions without the bells and whistles.
                         */
                        $list['Contributions'] = 'SpecialMobileContributions';
-
-                       if ( class_exists( 'MWEchoNotifUser' ) ) {
-                               $list['Notifications'] = 
'SpecialMobileNotifications';
-                       }
                }
                // add Special:Nearby only, if Nearby is activated
                if ( $ctx->getMFConfig()->get( 'MFNearby' ) ) {
diff --git a/includes/Resources.php b/includes/Resources.php
index 5c4d095..7c43993 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -1398,26 +1398,6 @@
                'position' => 'top',
        ),
 
-       'mobile.special.notifications.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-               'styles' => array(
-                       
'resources/mobile.special.notifications.styles/notifications.less',
-               ),
-               'position' => 'top',
-       ),
-
-       'mobile.special.notifications.scripts' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
-               'dependencies' => array(
-                       'mobile.startup',
-               ),
-               'scripts' => array(
-                       
'resources/mobile.special.notifications.scripts/notifications.js',
-               ),
-               'messages' => array(
-                       // defined in Echo
-                       'echo-load-more-error',
-               ),
-       ),
-
        // These are NOT empty see $wgResourceModuleSkinStyles.
        'mobile.special.history.styles' => 
$wgMFMobileSpecialPageResourceBoilerplate + array(
                'position' => 'top',
diff --git a/includes/specials/SpecialMobileNotifications.php 
b/includes/specials/SpecialMobileNotifications.php
deleted file mode 100644
index cc7f2ad..0000000
--- a/includes/specials/SpecialMobileNotifications.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * SpecialMobileNotifications.php
- */
-
-/**
- * Extends SpecialNotifications for a mobile-customized Notifications Special 
page
- * @todo This should be upstreamed to Echo extension after some design 
treatment
- * for desktop version
- */
-class SpecialMobileNotifications extends SpecialNotifications {
-       /**
-        * Reimplementation of SpecialNotifications:execute to add mobile 
specific stylesheet and Html
-        * @param string $par Parameter submitted as subpage
-        */
-       public function execute( $par ) {
-               $out = $this->getOutput();
-               $out->addModuleStyles( 'mobile.special.notifications.styles' );
-               $title = $out->getRequest()->getText( 'returnto' );
-               $title = Title::newFromText( $title );
-               if ( $title ) {
-                       $out->addHtml(
-                               Html::openElement( 'p' ) .
-                                       Html::element( 'a', array( 'href' => 
$title->getLocalUrl() ),
-                                               wfMessage( 'returnto', 
$title->getText() ) ) .
-                                       Html::closeElement( 'p' )
-                       );
-               }
-               parent::execute( $par );
-               $out->addModules( 'mobile.special.notifications.scripts' );
-       }
-
-       /**
-        * Don't show this page on Special:SpecialPages
-        * @return false
-        */
-       public function isListed() {
-               return false;
-       }
-}
diff --git a/resources/mobile.special.notifications.scripts/notifications.js 
b/resources/mobile.special.notifications.scripts/notifications.js
deleted file mode 100644
index 7a4cfbb..0000000
--- a/resources/mobile.special.notifications.scripts/notifications.js
+++ /dev/null
@@ -1,154 +0,0 @@
-( function ( M, $ ) {
-
-       var api = M.require( 'api' ),
-               notContinue = null,
-               header = '',
-               processing = false;
-
-       /**
-        * Initialises JavaScript on the mobile version of Special:Notifications
-        * @method
-        * @ignore
-        */
-       function initialize() {
-               // Convert more link into a button and bind to loadMore function
-               $( '#mw-echo-more' )
-                       .addClass( 'button' )
-                       .on( 'click', function ( ev ) {
-                               ev.preventDefault();
-                               if ( !processing ) {
-                                       processing = true;
-                                       loadMore();
-                               }
-                       } );
-               notContinue = mw.config.get( 'wgEchoNextContinue' );
-               header = mw.config.get( 'wgEchoDateHeader' );
-               mw.loader.using( 'ext.echo.logger', function () {
-                       $( '.mw-echo-notification' ).each( function () {
-                               var eventId = $( this ).attr( 
'data-notification-event' ),
-                                       eventType = $( this ).attr( 
'data-notification-type' );
-                               mw.echo.logger.logInteraction(
-                                       
mw.echo.Logger.static.actions.notificationImpression,
-                                       'mobile-archive',
-                                       eventId,
-                                       eventType,
-                                       true
-                               );
-                       } );
-               } );
-       }
-
-       /**
-        * Load more notification records.
-        * @method
-        * @ignore
-        */
-       function loadMore() {
-               var notifications, data, container, $li, unread = [];
-
-               // FIXME: Move to NotificationApi class
-               api.get( {
-                       action: 'query',
-                       meta: 'notifications',
-                       notformat: 'html',
-                       notprop: 'index|list',
-                       notcontinue: notContinue,
-                       notlimit: mw.config.get( 'wgEchoDisplayNum' )
-               } ).done( function ( result ) {
-                       container = $( '#mw-echo-special-container' );
-                       notifications = result.query.notifications;
-                       unread = [];
-
-                       $.each( notifications.index, function ( index, id ) {
-                               data = notifications.list[id];
-
-                               if ( header !== data.timestamp.date ) {
-                                       header = data.timestamp.date;
-                                       $( '<li>' ).addClass( 
'mw-echo-date-section' ).append( header ).appendTo( container );
-                               }
-
-                               $li = $( '<li>' )
-                                       .data( 'details', data )
-                                       .data( 'id', id )
-                                       .addClass( 'mw-echo-notification' )
-                                       .attr( {
-                                               // To facilitate debugging / 
bug reports
-                                               'data-notification-event': 
data.id
-                                       } )
-                                       .append( data['*'] )
-                                       .appendTo( container );
-
-                               if ( !data.read ) {
-                                       $li.addClass( 'mw-echo-unread' );
-                                       unread.push( id );
-                               }
-                               mw.loader.using( 'ext.echo.logger', function () 
{
-                                       var eventId = $li.attr( 
'data-notification-event' ),
-                                               eventType = $li.attr( 
'data-notification-type' );
-
-                                       mw.echo.logger.logInteraction(
-                                               
mw.echo.Logger.static.actions.notificationImpression,
-                                               'mobile-archive',
-                                               eventId,
-                                               eventType,
-                                               true
-                                       );
-                               } );
-                       } );
-
-                       notContinue = notifications.continue;
-                       if ( unread.length > 0 ) {
-                               markAsRead( unread );
-                       } else {
-                               onSuccess();
-                       }
-               } ).fail( function () {
-                       onError();
-               } );
-       }
-
-       /**
-        * Mark notifications as read.
-        * @method
-        * @param {Array} unread id of unread ids to mark as read
-        * @ignore
-        */
-       function markAsRead( unread ) {
-               // FIXME: Move to NotificationApi class
-               api.postWithToken( 'edit', {
-                       action: 'echomarkread',
-                       list: unread.join( '|' )
-               } ).done( onSuccess ).fail( onError );
-       }
-
-       /**
-        * onSuccess callback
-        * Sets processing to false. Also hides #mw-echo-more if notContinue is 
false.
-        * @method
-        * @ignore
-        * @private
-        */
-       function onSuccess() {
-               if ( !notContinue ) {
-                       $( '#mw-echo-more' ).hide();
-               }
-               processing = false;
-       }
-
-       /**
-        * Set #mw-echo-more text to the contents of echo-load-more-error 
message .
-        * Also sets processing to false.
-        * onError callback
-        * @method
-        * @ignore
-        * @private
-        */
-       function onError() {
-               // TODO: Show detail error message based on error code
-               $( '#mw-echo-more' ).text( mw.msg( 'echo-load-more-error' ) );
-               processing = false;
-       }
-
-       initialize();
-
-}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.special.notifications.styles/notifications.less 
b/resources/mobile.special.notifications.styles/notifications.less
deleted file mode 100644
index d412da0..0000000
--- a/resources/mobile.special.notifications.styles/notifications.less
+++ /dev/null
@@ -1,8 +0,0 @@
-@import "minerva.variables";
-@import "minerva.mixins";
-
-
-
-#mw-echo-more {
-       margin: 1em 0;
-}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bc41aca5965bab419349b25f1b04349282ef849
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to