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

Change subject: Fixes for Talk feature
......................................................................


Fixes for Talk feature

* Use Overlay.hogan, instead of talk.hogan as base Overlay template

* Fix Bug 70989

* Fix missing options when add a new discussion to a non existing talk page
(Bug 71028)

* Remove error code from error message when post new discussion and add
more specific error messages for some errors

Bug: 70989
Bug: 71028
Change-Id: Ic9a4d6b216509d28e4fa24869372c41fe31eb7a6
---
M i18n/en.json
M i18n/qqq.json
M includes/Resources.php
M javascripts/modules/talk/TalkOverlay.js
M javascripts/modules/talk/TalkSectionAddOverlay.js
M javascripts/modules/talk/TalkSectionOverlay.js
M templates/modules/talk/talk.hogan
7 files changed, 67 insertions(+), 29 deletions(-)

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



diff --git a/i18n/en.json b/i18n/en.json
index 2dab99d..6ec4be7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -274,7 +274,11 @@
     "mobile-frontend-talk-reply-info": "Note your reply will be automatically 
signed with your username.",
     "mobile-frontend-talk-reply-success": "Your reply was successfully saved 
to the talk page.",
     "mobile-frontend-talk-topic-feedback": "New topic added to talk page!",
-    "mobile-frontend-talk-topic-error": "The topic can't be added. Error: $1",
+    "mobile-frontend-talk-topic-error": "The topic can't be added due to an 
unknown Error.",
+    "mobile-frontend-talk-topic-error-protected": "This Talk page is 
protected, you don't have the permission to add topics to it.",
+    "mobile-frontend-talk-topic-error-permission": "The topic can't be added. 
You don't have the permission to edit pages.",
+    "mobile-frontend-talk-topic-error-spam": "The topic was refused because it 
contained a spam fragment.",
+    "mobile-frontend-talk-topic-error-badtoken": "There was an error on the 
server. Your edit can't be saved. Try reloading this page.",
     "mobile-frontend-terms-text": "Terms of Use",
     "mobile-frontend-terms-url": "",
     "mobile-frontend-thanked-notice": "$1 was told that you liked 
{{GENDER:$2|his|her|their}} edit.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b675b42..05c5a18 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -300,7 +300,11 @@
        "mobile-frontend-talk-reply-info": "Inform the user their talk reply 
will be automatically signed.",
        "mobile-frontend-talk-reply-success": "Toast message when you have 
saved a reply successfully.",
        "mobile-frontend-talk-topic-feedback": "Feedback when a topic has been 
added to talk page.",
-       "mobile-frontend-talk-topic-error": "Error message when topic could not 
be added. $1 - contains error details",
+       "mobile-frontend-talk-topic-error": "Generic error message, if the 
topic can't be saved, due to an unknown reason.",
+    "mobile-frontend-talk-topic-error-protected": "Error message, when the 
user tries to add a discussion to a protected talk page.",
+    "mobile-frontend-talk-topic-error-permission": "Error message, when the 
topic wasn't added to the talk page, because of a permission problem (no edit 
permission e.g.).",
+    "mobile-frontend-talk-topic-error-spam": "Error message explain, that the 
topic was rejected, because it's identified as spam.",
+    "mobile-frontend-talk-topic-error-badtoken": "This error message explains, 
that there was an error with the server (bad edit token), so the topic can't be 
saved to the talk page. The user should try to reload the page in his browser.",
        "mobile-frontend-terms-text": "\"Terms of use\" link text at the bottom 
of every page.\n{{Identical|Terms of use}}",
        "mobile-frontend-terms-url": "Terms of use URL. Do not localise",
        "mobile-frontend-thanked-notice": "{{doc-singularthey}}\nPop-up message 
that is displayed after a user has thanked another user for their 
edit.\n\nParameters:\n* $1 - the username of the user that was thanked\n* $2 - 
the gender of the user that was thanked",
diff --git a/includes/Resources.php b/includes/Resources.php
index c08c001..85f0bbf 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -492,6 +492,10 @@
                        'mobile-frontend-talk-reply-info',
                        'mobile-frontend-talk-topic-feedback',
                        'mobile-frontend-talk-topic-error',
+                       'mobile-frontend-talk-topic-error-protected',
+                       'mobile-frontend-talk-topic-error-permission',
+                       'mobile-frontend-talk-topic-error-spam',
+                       'mobile-frontend-talk-topic-error-badtoken',
                        // @todo FIXME: Gets loaded twice if editor and talk 
both loaded.
                        'mobile-frontend-editor-cancel',
                        'mobile-frontend-editor-cancel-confirm',
diff --git a/javascripts/modules/talk/TalkOverlay.js 
b/javascripts/modules/talk/TalkOverlay.js
index 62ea3de..6015267 100644
--- a/javascripts/modules/talk/TalkOverlay.js
+++ b/javascripts/modules/talk/TalkOverlay.js
@@ -12,14 +12,17 @@
                 * @class TalkOverlay
                 */
                TalkOverlay = Overlay.extend( {
-                       template: M.template.get( 'modules/talk/talk.hogan' ),
                        templatePartials: {
-                               header: M.template.get( 
'modules/talk/talkHeader.hogan' )
+                               content: M.template.get( 
'modules/talk/talk.hogan' )
                        },
                        defaults: {
-                               addTopicLabel: mw.msg( 
'mobile-frontend-talk-add-overlay-submit' ),
                                heading: '<strong>' + mw.msg( 
'mobile-frontend-talk-overlay-header' ) + '</strong>',
-                               leadHeading: mw.msg( 
'mobile-frontend-talk-overlay-lead-header' )
+                               leadHeading: mw.msg( 
'mobile-frontend-talk-overlay-lead-header' ),
+                               headerButtonsListClassName: 'overlay-action',
+                               headerButtons: [ {
+                                       className: 'add continue hidden',
+                                       msg: mw.msg( 
'mobile-frontend-talk-add-overlay-submit' )
+                               } ]
                        },
 
                        postRender: function( options ) {
@@ -63,7 +66,7 @@
                                        // talk page doesn't exist yet.
                                        if ( resp === 'missingtitle' ) {
                                                // Create an empty page for new 
pages
-                                               self._addContent( { title: 
options.title, sections: [] } );
+                                               self._addContent( { title: 
options.title, sections: [] }, options );
                                        } else {
                                                // If the API request fails for 
any other reason, load the talk
                                                // page manually rather than 
leaving the spinner spinning.
@@ -117,7 +120,9 @@
                                                var overlay = new 
TalkSectionAddOverlay( {
                                                        title: page.title
                                                } );
-                                               overlay.show();
+                                               // Hide discussion list to 
disable scrolling - bug 70989
+                                               // FIXME: Kill when 
OverlayManager is used for TalkSectionAdd
+                                               self.$board.hide();
                                                overlay.on( 
'talk-discussion-added', function() {
                                                        // reload the content
                                                        self._loadContent( 
options );
@@ -125,7 +130,9 @@
                                                        // re-enable 
TalkOverlay (it's closed by hide event (in Overlay)
                                                        // from 
TalkSectionAddOverlay)
                                                        self.show();
-                                               } );
+                                                       // FIXME: Kill when 
OverlayManager is used for TalkSectionAdd
+                                                       self.$board.show();
+                                               } ).show();
                                                // When closing this overlay, 
also close the child section overlay
                                                self.on( 'hide', function() {
                                                        overlay.remove();
@@ -149,6 +156,9 @@
                                                        title: page.title,
                                                        section: section
                                                } );
+                                       // Hide discussion list to disable 
scrolling - bug 70989
+                                       // FIXME: Kill when OverlayManager is 
used for TalkSections
+                                       self.$board.hide();
                                        childOverlay.show();
                                        // When closing this overlay, also 
close the child section overlay
                                        self.on( 'hide', function() {
diff --git a/javascripts/modules/talk/TalkSectionAddOverlay.js 
b/javascripts/modules/talk/TalkSectionAddOverlay.js
index 7e4cd99..ebcf2c1 100644
--- a/javascripts/modules/talk/TalkSectionAddOverlay.js
+++ b/javascripts/modules/talk/TalkSectionAddOverlay.js
@@ -53,11 +53,29 @@
                                                        self.hide();
                                                }
                                        } ).fail( function( error ) {
+                                               var editMsg = 
'mobile-frontend-talk-topic-error';
+
                                                self.confirm.prop( 'disabled', 
false );
-                                               toast.show(
-                                                       mw.msg( 
'mobile-frontend-talk-topic-error', error.details ),
-                                                       'toast error'
-                                               );
+                                               switch ( error.details ) {
+                                                       case "protectedpage":
+                                                               editMsg = 
'mobile-frontend-talk-topic-error-protected';
+                                                               break;
+                                                       case "noedit":
+                                                       case "blocked":
+                                                               editMsg = 
'mobile-frontend-talk-topic-error-permission';
+                                                               break;
+                                                       case "spamdetected":
+                                                               editMsg = 
'mobile-frontend-talk-topic-error-spam';
+                                                               break;
+                                                       case "badtoken":
+                                                               editMsg = 
'mobile-frontend-talk-topic-error-badtoken';
+                                                               break;
+                                                       default:
+                                                               editMsg = 
'mobile-frontend-talk-topic-error';
+                                                               break;
+                                               }
+
+                                               toast.show( mw.msg( editMsg ), 
'toast error' );
                                        } );
                                }
                        } );
diff --git a/javascripts/modules/talk/TalkSectionOverlay.js 
b/javascripts/modules/talk/TalkSectionOverlay.js
index 8695b1c..d949d6b 100644
--- a/javascripts/modules/talk/TalkSectionOverlay.js
+++ b/javascripts/modules/talk/TalkSectionOverlay.js
@@ -16,6 +16,9 @@
                },
                // FIXME: Use Router for TalkSectionOverlay
                hide: function() {
+                       if ( this.$board ) {
+                               this.$board.show();
+                       }
                        this.remove();
                },
                initialize: function( options ) {
@@ -32,6 +35,7 @@
                                        mw.config.get( 'wgMFLicenseLink' )
                                );
                        }
+                       this.$board = options.parent.$board;
                        Overlay.prototype.initialize.apply( this, arguments );
                },
                postRender: function( options ) {
diff --git a/templates/modules/talk/talk.hogan 
b/templates/modules/talk/talk.hogan
index 6670d00..aeeed84 100644
--- a/templates/modules/talk/talk.hogan
+++ b/templates/modules/talk/talk.hogan
@@ -1,17 +1,11 @@
-<div class="overlay-header-container position-fixed">
-       {{>header}}
+<div class="board">
+       <p class="content-header">
+               {{explanation}}
+       </p>
+       <ul class="page-list actionable">
+               <li class="lead-discussion">
+                       <a data-id="0">{{leadHeading}}</a>
+               </li>
+       </ul>
 </div>
-
-<div class="overlay-content">
-       <div class="board">
-               <p class="content-header">
-                       {{explanation}}
-               </p>
-               <ul class="page-list actionable">
-                       <li class="lead-discussion">
-                               <a data-id="0">{{leadHeading}}</a>
-                       </li>
-               </ul>
-       </div>
-       <div class="spinner loading"></div>
-</div>
+<div class="spinner loading"></div>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9a4d6b216509d28e4fa24869372c41fe31eb7a6
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[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