Jdlrobson has uploaded a new change for review.

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


Change subject: Talk: Write the number of talk topics in the talk bubble
......................................................................

Talk: Write the number of talk topics in the talk bubble

This gives a sense of the underlying talk page without the user
having to go to the talk page.

This is amazing-a-balls imho

Change-Id: I4833a35b121eb4cd1f2e857079cadea6146d30c8
---
M includes/skins/SkinMobile.php
1 file changed, 13 insertions(+), 3 deletions(-)


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

diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 03265e3..6b5c9e9 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -176,11 +176,21 @@
                                $preBodyText = Html::rawElement( 'h1', 
$headingOptions, $pageHeading );
                                // talk page link for logged in alpha users
                                if ( $inAlpha && $user->isLoggedIn() ) {
-                                       $talkLabel = wfMessage( 
'mobile-frontend-talk-overlay-header' ); // FIXME: make this the number of 
sections on the talk page
+                                       $talkTitle = $title->getTalkPage();
+                                       $wp = WikiPage::factory( $talkTitle );
+                                       $parserOptions = 
$wp->makeParserOptions( $this->getContext() );
+                                       $parserOutput = $wp->getParserOutput( 
$parserOptions );
+                                       $sections = 
$parserOutput->getSections();
+                                       $numTopics = 0;
+                                       foreach( $sections as $section ) {
+                                               if ( $section['toclevel'] == 1 
) {
+                                                       $numTopics += 1;
+                                               }
+                                       }
                                        if ( $title->getNamespace() !== NS_TALK 
) {
                                                $preBodyText .= Html::element( 
'a',
-                                                       array( 'href' => 
$title->getTalkPage()->getFullUrl(), 'id' => 'talk' ),
-                                                       $talkLabel );
+                                                       array( 'href' => 
$talkTitle->getFullUrl(), 'id' => 'talk' ),
+                                                       $numTopics );
                                        }
                                }
                        }

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

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

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

Reply via email to