Matmarex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64576
Change subject: RecentChanges, RecentChangesLinked, Watchlist: message when no
items
......................................................................
RecentChanges, RecentChangesLinked, Watchlist: message when no items
Use consistent message in RecentChanges, RecentChangesLinked, and
Watchlist when there are no items to be shown.
Previously RecentChanges just showed empty space and
RecentChangesLinked and Watchlist used two different messages.
Harmonized both the text and the code.
Message added: 'recentchanges-noresult'
Messages removed: 'recentchangeslinked-noresult', 'watchnochange'
Change-Id: Idf9f7a8422d9ad13dc46c69ee284b04cbbe211b7
---
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialRecentchangeslinked.php
M includes/specials/SpecialWatchlist.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
5 files changed, 47 insertions(+), 48 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/76/64576/1
diff --git a/includes/specials/SpecialRecentchanges.php
b/includes/specials/SpecialRecentchanges.php
index 1f10ad4..4310a92 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -516,45 +516,51 @@
$counter = 1;
$list = ChangesList::newFromContext( $this->getContext() );
- $s = $list->beginRecentChangesList();
- foreach ( $rows as $obj ) {
- if ( $limit == 0 ) {
- break;
- }
- $rc = RecentChange::newFromRow( $obj );
- $rc->counter = $counter++;
- # Check if the page has been updated since the last
visit
- if ( $wgShowUpdatedMarker && !empty(
$obj->wl_notificationtimestamp ) ) {
- $rc->notificationtimestamp = (
$obj->rc_timestamp >= $obj->wl_notificationtimestamp );
- } else {
- $rc->notificationtimestamp = false; // Default
- }
- # Check the number of users watching the page
- $rc->numberofWatchingusers = 0; // Default
- if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
- if ( !isset(
$watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
-
$watcherCache[$obj->rc_namespace][$obj->rc_title] =
- $dbr->selectField(
- 'watchlist',
- 'COUNT(*)',
- array(
- 'wl_namespace'
=> $obj->rc_namespace,
- 'wl_title' =>
$obj->rc_title,
- ),
- __METHOD__ . '-watchers'
- );
+ if ( $rows ) {
+ $s = $list->beginRecentChangesList();
+ foreach ( $rows as $obj ) {
+ if ( $limit == 0 ) {
+ break;
}
- $rc->numberofWatchingusers =
$watcherCache[$obj->rc_namespace][$obj->rc_title];
- }
+ $rc = RecentChange::newFromRow( $obj );
+ $rc->counter = $counter++;
+ # Check if the page has been updated since the
last visit
+ if ( $wgShowUpdatedMarker && !empty(
$obj->wl_notificationtimestamp ) ) {
+ $rc->notificationtimestamp = (
$obj->rc_timestamp >= $obj->wl_notificationtimestamp );
+ } else {
+ $rc->notificationtimestamp = false; //
Default
+ }
+ # Check the number of users watching the page
+ $rc->numberofWatchingusers = 0; // Default
+ if ( $showWatcherCount && $obj->rc_namespace >=
0 ) {
+ if ( !isset(
$watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
+
$watcherCache[$obj->rc_namespace][$obj->rc_title] =
+ $dbr->selectField(
+ 'watchlist',
+ 'COUNT(*)',
+ array(
+
'wl_namespace' => $obj->rc_namespace,
+
'wl_title' => $obj->rc_title,
+ ),
+ __METHOD__ .
'-watchers'
+ );
+ }
+ $rc->numberofWatchingusers =
$watcherCache[$obj->rc_namespace][$obj->rc_title];
+ }
- $changeLine = $list->recentChangesLine( $rc, !empty(
$obj->wl_user ), $counter );
- if ( $changeLine !== false ) {
- $s .= $changeLine;
- --$limit;
+ $changeLine = $list->recentChangesLine( $rc,
!empty( $obj->wl_user ), $counter );
+ if ( $changeLine !== false ) {
+ $s .= $changeLine;
+ --$limit;
+ }
}
+ $s .= $list->endRecentChangesList();
+ $this->getOutput()->addHTML( $s );
+ } else {
+ $this->getOutput()->wrapWikiMsg(
+ "<div
class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
+ );
}
- $s .= $list->endRecentChangesList();
- $this->getOutput()->addHTML( $s );
}
/**
@@ -707,8 +713,7 @@
}
/**
- * Send the text to be displayed after the options, for use in
- * Recentchangeslinked
+ * Send the text to be displayed after the options, for use in
subclasses.
*
* @param FormOptions $opts
*/
diff --git a/includes/specials/SpecialRecentchangeslinked.php
b/includes/specials/SpecialRecentchangeslinked.php
index 4773c4a..6277777 100644
--- a/includes/specials/SpecialRecentchangeslinked.php
+++ b/includes/specials/SpecialRecentchangeslinked.php
@@ -265,10 +265,4 @@
$this->getOutput()->addBacklinkSubtitle( $target );
}
}
-
- function setBottomText( FormOptions $opts ) {
- if ( isset( $this->mResultEmpty ) && $this->mResultEmpty ) {
- $this->getOutput()->addWikiMsg(
'recentchangeslinked-noresult' );
- }
- }
}
diff --git a/includes/specials/SpecialWatchlist.php
b/includes/specials/SpecialWatchlist.php
index 4c7ea90..eb3cc8fd 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -386,7 +386,9 @@
# If there's nothing to show, stop here
if ( $numRows == 0 ) {
- $output->addWikiMsg( 'watchnochange' );
+ $output->wrapWikiMsg(
+ "<div
class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
+ );
return;
}
diff --git a/languages/messages/MessagesEn.php
b/languages/messages/MessagesEn.php
index 4752372..2606b23 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -2146,6 +2146,7 @@
'recentchanges-legend' => 'Recent changes options',
'recentchanges-summary' => 'Track the most recent changes to the
wiki on this page.',
'recentchangestext' => '-', # do not translate or duplicate
this message to other languages
+'recentchanges-noresult' => 'No changes during the given period
matching these criteria.',
'recentchanges-feed-description' => 'Track the most recent changes to the
wiki in this feed.',
'recentchanges-label-newpage' => 'This edit created a new page',
'recentchanges-label-minor' => 'This is a minor edit',
@@ -2185,7 +2186,6 @@
'recentchangeslinked-feed' => 'Related changes',
'recentchangeslinked-toolbox' => 'Related changes',
'recentchangeslinked-title' => 'Changes related to "$1"',
-'recentchangeslinked-noresult' => 'No changes on linked pages during the given
period.',
'recentchangeslinked-summary' => "This is a list of changes made recently to
pages linked from a specified page (or to members of a specified category).
Pages on [[Special:Watchlist|your watchlist]] are '''bold'''.",
'recentchangeslinked-page' => 'Page name:',
@@ -2909,7 +2909,6 @@
'unwatchthispage' => 'Stop watching',
'notanarticle' => 'Not a content page',
'notvisiblerev' => 'The last revision by a different user has been
deleted',
-'watchnochange' => 'None of your watched items were edited in the time
period displayed.',
'watchlist-details' => '{{PLURAL:$1|$1 page|$1 pages}} on your watchlist,
not counting talk pages.',
'wlheader-enotif' => 'Email notification is enabled.',
'wlheader-showupdated' => "Pages that have been changed since you last visited
them are shown in '''bold'''.",
diff --git a/languages/messages/MessagesQqq.php
b/languages/messages/MessagesQqq.php
index 821f8c3..1492c12 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -2967,6 +2967,7 @@
{{Identical|Recent changes}}',
'recentchanges-legend' => 'Legend of the fieldset of
[[Special:RecentChanges]]',
'recentchanges-summary' => 'Summary of [[Special:RecentChanges]].',
+'recentchanges-noresult' => 'Used in [[Special:RecentChanges]],
[[Special:RecentChangesLinked]], and [[Special:Watchlist]] when there are no
changes to be shown.',
'recentchanges-feed-description' => 'Used in feed of RecentChanges. See
example [{{canonicalurl:Special:RecentChanges|feed=atom}} feed].',
'recentchanges-label-newpage' => 'Tooltip for {{msg-mw|newpageletter}}',
'recentchanges-label-minor' => 'Tooltip for {{msg-mw|minoreditletter}}',
@@ -3065,7 +3066,6 @@
Parameters:
* \$1 - the name of the page for which related changes are shown",
-'recentchangeslinked-noresult' => 'Used in [[Special:RecentChangesLinked]],
when there are no changes.',
'recentchangeslinked-summary' => 'Summary of [[Special:RecentChangesLinked]].',
'recentchangeslinked-page' => '{{Identical|Page name}}',
'recentchangeslinked-to' => 'Checkbox in [[Special:RecentChangesLinked]].',
@@ -4502,7 +4502,6 @@
See also:
* {{msg-mw|Cantrollback}}',
-'watchnochange' => 'Used in [[Special:Watchlist]] if there is nothing to
show.',
'watchlist-details' => 'Message at the top of [[Special:Watchlist]]. Has to be
a full sentence. Parameters:
* $1 - number of pages in your watchlist
This is paired with the message {{msg-mw|Nowatchlist}} which appears instead
of Watchlist-details when $1 is 0.
--
To view, visit https://gerrit.wikimedia.org/r/64576
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf9f7a8422d9ad13dc46c69ee284b04cbbe211b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits