jenkins-bot has submitted this change and it was merged.
Change subject: Story 1891: Push new Watchlist feed to stable
......................................................................
Story 1891: Push new Watchlist feed to stable
Cleanup browser tests in process and ensure they are compatible
with new HTML markup
Change-Id: Ie948ef689616523b6718c491628d8b503dd0cc6a
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
M includes/specials/MobileSpecialPageFeed.php
M includes/specials/SpecialMobileHistory.php
M includes/specials/SpecialMobileWatchlist.php
D includes/specials/SpecialMobileWatchlistBeta.php
R tests/browser/features/special_watchlist.feature
R tests/browser/features/step_definitions/special_watchlist_steps.rb
A tests/browser/features/step_definitions/watchstar_steps.rb
M tests/browser/features/support/pages/watchlist_page.rb
10 files changed, 29 insertions(+), 131 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 728b9e7..7def197 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -74,7 +74,6 @@
'SpecialMobileOptions' => 'specials/SpecialMobileOptions',
'SpecialMobileMenu' => 'specials/SpecialMobileMenu',
'SpecialMobileWatchlist' => 'specials/SpecialMobileWatchlist',
- 'SpecialMobileWatchlistBeta' => 'specials/SpecialMobileWatchlistBeta',
'SpecialMobileContributions' => 'specials/SpecialMobileContributions',
'SpecialNearby' => 'specials/SpecialNearby',
'SpecialMobileLanguages' => 'specials/SpecialMobileLanguages',
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 6a5a627..9a35a2c 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -307,7 +307,6 @@
* Special:Contributions without the bells and
whistles.
*/
$list['Contributions'] =
'SpecialMobileContributions';
- $list['Watchlist'] =
'SpecialMobileWatchlistBeta';
}
$list['Userlogin'] = 'SpecialMobileUserlogin';
diff --git a/includes/specials/MobileSpecialPageFeed.php
b/includes/specials/MobileSpecialPageFeed.php
index bf0880d..435aac0 100644
--- a/includes/specials/MobileSpecialPageFeed.php
+++ b/includes/specials/MobileSpecialPageFeed.php
@@ -33,52 +33,6 @@
}
/**
- * Renders an item in the feed
- * @param MWTimestamp $ts The time the edit occurred
- * @param string $diffLink url to the diff for the edit
- * @param string $username The username of the user that made the edit
(absent if anonymous)
- * @param string $comment The edit summary
- * @param Title $title The title of the page that was edited
- * @param bool $isAnon Whether the user for this edit was anonymous
- *
- * @return String: HTML code
- */
- protected function renderFeedItemHtml( $ts, $diffLink = '', $username =
'', $comment = '',
- $title = false, $isAnon = false ) {
-
- $out = $this->getOutput();
- if ( $isAnon ) {
- $username = $this->msg(
'mobile-frontend-changeslist-ip' )->plain();
- $usernameClass = 'mw-mf-user mw-mf-anon';
- } else {
- $usernameClass = 'mw-mf-user';
- }
-
- $html = '<li>';
- if ( $diffLink ) {
- $html .= Html::openElement( 'a', array( 'href' =>
$diffLink, 'class' => 'title' ) );
- } else {
- $html .= Html::openElement( 'div', array( 'class' =>
'title' ) );
- }
- if ( $title ) {
- $html .= Html::element( 'h3', array(),
$title->getPrefixedText() );
- }
- if ( $username ) {
- $html .= Html::element( 'p', array( 'class' =>
$usernameClass ), $username );
- }
- $html .= Html::element( 'p', array( 'class' => 'mw-mf-comment
truncated-text' ), $comment ) .
- Html::element( 'div', array( 'class' => 'info' ),
$ts->getHumanTimestamp() );
-
- if ( $diffLink ) {
- $html .= Html::closeElement( 'a' );
- } else {
- $html .= Html::closeElement( 'div' );
- }
- $html .= '</li>';
- $out->addHtml( $html );
- }
-
- /**
* Renders a date header when necessary.
* FIXME: Juliusz won't like this function.
* @param MWTimestamp date The date of the current item
@@ -113,7 +67,7 @@
* @return string HTML code
*/
// FIXME: use an array as an argument?
- protected function renderFeedItemHtmlBeta( $ts, $diffLink = '',
$username = '', $comment = '',
+ protected function renderFeedItemHtml( $ts, $diffLink = '', $username =
'', $comment = '',
$title = false, $isAnon = false, $bytes = 0, $isMinor = false )
{
wfProfileIn( __METHOD__ );
diff --git a/includes/specials/SpecialMobileHistory.php
b/includes/specials/SpecialMobileHistory.php
index 643b741..7abe3bb 100644
--- a/includes/specials/SpecialMobileHistory.php
+++ b/includes/specials/SpecialMobileHistory.php
@@ -1,8 +1,8 @@
<?php
class SpecialMobileHistory extends MobileSpecialPageFeed {
- const LIMIT = 50;
protected $mode = 'beta';
+ const LIMIT = 50;
/** @var String|null timestamp to offset results from */
protected $offset;
@@ -159,8 +159,7 @@
$bytes -= $prev->getSize();
}
$isMinor = $rev->isMinor();
- // FIXME: When this function changes name to renderFeedItemHtml
make sure you change it here too
- $this->renderFeedItemHtmlBeta( $ts, $diffLink, $username,
$comment, $title, $isAnon, $bytes,
+ $this->renderFeedItemHtml( $ts, $diffLink, $username, $comment,
$title, $isAnon, $bytes,
$isMinor );
wfProfileOut( __METHOD__ );
diff --git a/includes/specials/SpecialMobileWatchlist.php
b/includes/specials/SpecialMobileWatchlist.php
index 16fd395..3de08a9 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -345,11 +345,6 @@
}
protected function showFeedResults( ResultWrapper $res ) {
- $output = $this->getOutput();
- $output->addHtml(
- Html::openElement( 'ul', array( 'class' => 'watchlist '
. 'page-list' ) )
- );
-
$this->showResults( $res, true );
}
@@ -490,15 +485,22 @@
}
$output = $this->getOutput();
+ $user = $this->getUser();
+ $lang = $this->getLanguage();
+
+ $date = $lang->userDate( $row->rc_timestamp, $user );
+ $this->renderListHeaderWhereNeeded( $date );
$title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
$comment = $this->formatComment( $row->rc_comment, $title );
$ts = new MWTimestamp( $row->rc_timestamp );
- $username = $row->rc_user != 0 && isset( $row->rc_user_text )
+ $username = $row->rc_user != 0
? htmlspecialchars( $row->rc_user_text )
- : '';
+ : IP::prettifyIP( $row->rc_user_text );
$revId = $row->rc_this_oldid;
+ $bytes = $row->rc_new_len - $row->rc_old_len;
$isAnon = $row->rc_user == 0;
+ $isMinor = $row->rc_minor != 0;
if ( $revId ) {
$diffTitle = SpecialPage::getTitleFor( 'MobileDiff',
$revId );
@@ -508,8 +510,8 @@
$diffLink = Title::makeTitle( $row->rc_namespace,
$row->rc_title )->getLocalUrl();
}
- $this->renderFeedItemHtml( $ts, $diffLink, $username, $comment,
$title, $isAnon );
-
+ $this->renderFeedItemHtml( $ts, $diffLink, $username, $comment,
$title, $isAnon, $bytes,
+ $isMinor );
wfProfileOut( __METHOD__ );
}
@@ -554,4 +556,13 @@
$this->optionsChanged = true;
}
}
+
+ protected function formatComment( $comment, $title ) {
+ if ( $comment !== '' ) {
+ $comment = Linker::formatComment( $comment, $title );
+ // flatten back to text
+ $comment = Sanitizer::stripAllTags( $comment );
+ }
+ return $comment;
+ }
}
diff --git a/includes/specials/SpecialMobileWatchlistBeta.php
b/includes/specials/SpecialMobileWatchlistBeta.php
deleted file mode 100644
index 2d6798b..0000000
--- a/includes/specials/SpecialMobileWatchlistBeta.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-class SpecialMobileWatchlistBeta extends SpecialMobileWatchlist {
- protected $lastRow;
-
- protected function showFeedResults( ResultWrapper $res ) {
- $this->showResults( $res, true );
- }
-
- protected function formatComment( $comment, $title ) {
- if ( $comment !== '' ) {
- $comment = Linker::formatComment( $comment, $title );
- // flatten back to text
- $comment = Sanitizer::stripAllTags( $comment );
- }
- return $comment;
- }
-
- protected function showFeedResultRow( $row ) {
- wfProfileIn( __METHOD__ );
-
- if ( $row->rc_deleted ) {
- wfProfileOut( __METHOD__ );
- return;
- }
-
- $output = $this->getOutput();
- $user = $this->getUser();
- $lang = $this->getLanguage();
-
- $date = $lang->userDate( $row->rc_timestamp, $user );
- $this->renderListHeaderWhereNeeded( $date );
-
- $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
- $comment = $this->formatComment( $row->rc_comment, $title );
- $ts = new MWTimestamp( $row->rc_timestamp );
- $username = $row->rc_user != 0
- ? htmlspecialchars( $row->rc_user_text )
- : IP::prettifyIP( $row->rc_user_text );
- $revId = $row->rc_this_oldid;
- $bytes = $row->rc_new_len - $row->rc_old_len;
- $isAnon = $row->rc_user == 0;
- $isMinor = $row->rc_minor != 0;
-
- if ( $revId ) {
- $diffTitle = SpecialPage::getTitleFor( 'MobileDiff',
$revId );
- $diffLink = $diffTitle->getLocalUrl();
- } else {
- // hack -- use full log entry display
- $diffLink = Title::makeTitle( $row->rc_namespace,
$row->rc_title )->getLocalUrl();
- }
-
- $this->renderFeedItemHtml( $ts, $diffLink, $username, $comment,
$title, $isAnon, $bytes,
- $isMinor );
- wfProfileOut( __METHOD__ );
- }
-
- protected function renderFeedItemHtml( $ts, $diffLink = '', $username =
'', $comment = '',
- $title = false, $isAnon = false, $bytes = 0, $isMinor = false )
{
- $this->renderFeedItemHtmlBeta( $ts, $diffLink,
$username, $comment,
- $title, $isAnon, $bytes, $isMinor );
- }
-}
diff --git a/tests/browser/features/watchlist.feature
b/tests/browser/features/special_watchlist.feature
similarity index 100%
rename from tests/browser/features/watchlist.feature
rename to tests/browser/features/special_watchlist.feature
diff --git a/tests/browser/features/step_definitions/watchlist_steps.rb
b/tests/browser/features/step_definitions/special_watchlist_steps.rb
similarity index 78%
rename from tests/browser/features/step_definitions/watchlist_steps.rb
rename to tests/browser/features/step_definitions/special_watchlist_steps.rb
index 1f1c2b0..dbeafbc 100644
--- a/tests/browser/features/step_definitions/watchlist_steps.rb
+++ b/tests/browser/features/step_definitions/special_watchlist_steps.rb
@@ -1,9 +1,3 @@
-Given(/^the page is unwatched$/) do
- unwatch_url = ENV["MEDIAWIKI_URL"] + @random_string + "?action=unwatch"
- @browser.goto(unwatch_url)
- on(ArticlePage).watch_confirm_element.when_present.click
-end
-
When(/^I switch to the modified view of the watchlist$/) do
on(WatchlistPage).feed_link_element.click
end
diff --git a/tests/browser/features/step_definitions/watchstar_steps.rb
b/tests/browser/features/step_definitions/watchstar_steps.rb
new file mode 100644
index 0000000..1bdc4e6
--- /dev/null
+++ b/tests/browser/features/step_definitions/watchstar_steps.rb
@@ -0,0 +1,5 @@
+Given(/^the page is unwatched$/) do
+ unwatch_url = ENV["MEDIAWIKI_URL"] + @random_string + "?action=unwatch"
+ @browser.goto(unwatch_url)
+ on(ArticlePage).watch_confirm_element.when_present.click
+end
diff --git a/tests/browser/features/support/pages/watchlist_page.rb
b/tests/browser/features/support/pages/watchlist_page.rb
index 2394259..7a57abc 100644
--- a/tests/browser/features/support/pages/watchlist_page.rb
+++ b/tests/browser/features/support/pages/watchlist_page.rb
@@ -3,6 +3,6 @@
a(:list_link, text: "List")
a(:feed_link, text: "Modified")
- ul(:page_list_diffs, class: "watchlist page-list")
+ ul(:page_list_diffs, class: "page-list side-list")
ul(:page_list_a_to_z, class: "watchlist page-list thumbs")
end
--
To view, visit https://gerrit.wikimedia.org/r/127193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie948ef689616523b6718c491628d8b503dd0cc6a
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits