MaxSem has uploaded a new change for review.

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


Change subject: WIP: Bug 44126 - don't request watch status dynamically
......................................................................

WIP: Bug 44126 - don't request watch status dynamically

Change-Id: Ifdff6f3134ade1c8620869c826930a05a9129368
---
M includes/skins/SkinMobile.php
1 file changed, 11 insertions(+), 0 deletions(-)


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

diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 9f8af15..a2748d2 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -69,6 +69,16 @@
                $tpl->set( 'useFormatCookieDomain', $_SERVER['HTTP_HOST'] );
                $tpl->set( 'isSpecialPage', $title->isSpecialPage() );
 
+               if ( $title->canExist() ) {
+                       $watched = $this->getUser()->isWatched( $title );
+                       $url = $this->getTitle()->getLocalURL( array( 'action' 
=> ( $watched ? 'unwatch' : 'watch' ) ) );
+                       $class = $watched ? ' watched' : '';
+                       $button = Html::element( 'a', array( 'href' => $url, 
'class' => $class ) );
+               } else {
+                       $button = '';
+               }
+               $tpl->set( 'watchButton', $button );
+
                // footer
                $tpl->set( 'copyright', $this->getCopyright() );
 
@@ -917,6 +927,7 @@
                                        ?>" autocomplete="off" maxlength="1024" 
class="search"
                                        placeholder="<?php echo $placeholder ?>"
                                        />
+                               <?php $this->html( 'watchButton' ) ?>
                                <input class='searchSubmit' type="submit" 
value="<?php $this->msg( 'mobile-frontend-search-submit' ) ?>">
                        </div>
                </form>

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

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

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

Reply via email to