jenkins-bot has submitted this change and it was merged.
Change subject: Enhanced RC: Add a "view changes since my last visit" link
......................................................................
Enhanced RC: Add a "view changes since my last visit" link
It's only shown if there are any unviewed changes and if as least one
of previous versions was viewed already.
* Added new message 'enhancedrc-since-last-visit' for link text
* Added 'enhancedrc-history' to replace 'hist' in enhanced RC context
Bug: 51901
Change-Id: Id74fe88bb2a1879651935ac56e9cdcb2e54b331f
---
M includes/ChangesList.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
M maintenance/language/messages.inc
4 files changed, 51 insertions(+), 10 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/ChangesList.php b/includes/ChangesList.php
index f3dcf67..9c441af 100644
--- a/includes/ChangesList.php
+++ b/includes/ChangesList.php
@@ -122,7 +122,7 @@
private function preCacheMessages() {
if ( !isset( $this->message ) ) {
foreach ( array(
- 'cur', 'diff', 'hist', 'last', 'blocklink',
'history',
+ 'cur', 'diff', 'hist', 'enhancedrc-history',
'last', 'blocklink', 'history',
'semicolon-separator', 'pipe-separator' ) as
$msg
) {
$this->message[$msg] = $this->msg( $msg
)->escaped();
@@ -976,12 +976,30 @@
$r .= $this->getLanguage()->getDirMark();
$queryParams['curid'] = $curId;
+
# Changes message
- $n = count( $block );
static $nchanges = array();
+ static $sinceLastVisitMsg = array();
+
+ $n = count( $block );
if ( !isset( $nchanges[$n] ) ) {
$nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n
)->escaped();
}
+
+ $sinceLast = 0;
+ $unvisitedOldid = null;
+ foreach ( $block as $rcObj ) {
+ // Same logic as below inside main foreach
+ if ( $rcObj->watched &&
$rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
+ $sinceLast++;
+ $unvisitedOldid =
$rcObj->mAttribs['rc_last_oldid'];
+ }
+ }
+ if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
+ $sinceLastVisitMsg[$sinceLast] =
+ $this->msg( 'enhancedrc-since-last-visit'
)->numParams( $sinceLast )->escaped();
+ }
+
# Total change link
$r .= ' ';
$logtext = '';
@@ -991,17 +1009,28 @@
} elseif ( $isnew ) {
$logtext .= $nchanges[$n];
} else {
- $params = $queryParams;
- $params['diff'] = $currentRevision;
- $params['oldid'] = $oldid;
-
$logtext .= Linker::link(
$block[0]->getTitle(),
$nchanges[$n],
array(),
- $params,
+ $queryParams + array(
+ 'diff' => $currentRevision,
+ 'oldid' => $oldid,
+ ),
array( 'known', 'noclasses' )
);
+ if ( $sinceLast > 0 && $sinceLast < $n ) {
+ $logtext .=
$this->message['pipe-separator'] . Linker::link(
+ $block[0]->getTitle(),
+ $sinceLastVisitMsg[$sinceLast],
+ array(),
+ $queryParams + array(
+ 'diff' =>
$currentRevision,
+ 'oldid' =>
$unvisitedOldid,
+ ),
+ array( 'known', 'noclasses' )
+ );
+ }
}
}
@@ -1009,7 +1038,7 @@
if ( $allLogs ) {
// don't show history link for logs
} elseif ( $namehidden || !$block[0]->getTitle()->exists() ) {
- $logtext .= $this->message['pipe-separator'] .
$this->message['hist'];
+ $logtext .= $this->message['pipe-separator'] .
$this->message['enhancedrc-history'];
} else {
$params = $queryParams;
$params['action'] = 'history';
@@ -1017,7 +1046,7 @@
$logtext .= $this->message['pipe-separator'] .
Linker::linkKnown(
$block[0]->getTitle(),
- $this->message['hist'],
+ $this->message['enhancedrc-history'],
array(),
$params
);
diff --git a/languages/messages/MessagesEn.php
b/languages/messages/MessagesEn.php
index f98267b..72ea315 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -2195,6 +2195,8 @@
# Recent changes
'nchanges' => '$1 {{PLURAL:$1|change|changes}}',
+'enhancedrc-since-last-visit' => '$1 {{PLURAL:$1|since last visit}}',
+'enhancedrc-history' => 'history',
'recentchanges' => 'Recent changes',
'recentchanges-url' => 'Special:RecentChanges', # do not
translate or duplicate this message to other languages
'recentchanges-legend' => 'Recent changes options',
diff --git a/languages/messages/MessagesQqq.php
b/languages/messages/MessagesQqq.php
index 73e6199..cc6e13b 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -3357,7 +3357,15 @@
'action-editmyprivateinfo' => '{{doc-action|editmyprivateinfo}}',
# Recent changes
-'nchanges' => 'Appears on the [[Special:RecentChanges]] special page in
brackets after pages having more than one change on that date. $1 is the number
of changes on that day.',
+'nchanges' => 'Appears on enhanced watchlist and recent changes when page has
more than one change on given date, linking to a diff of the changes.
+$1 is the number of changes on that day (2 or more).
+Three messages are shown side-by-side: ({{msg-mw|nchanges}} |
{{msg-mw|enhancedrc-since-last-visit}} | {{msg-mw|enhancedrc-history}}).',
+'enhancedrc-since-last-visit' => 'Appears on enhanced watchlist and recent
changes when page has more than one change on given date and at least one that
the user hasn\'t seen yet, linking to a diff of the unviewed changes.
+$1 is the number of unviewed changes (1 or more).
+Three messages are shown side-by-side: ({{msg-mw|nchanges}} |
{{msg-mw|enhancedrc-since-last-visit}} | {{msg-mw|enhancedrc-history}}).',
+'enhancedrc-history' => 'Appears on enhanced watchlist and recent changes when
page has more than one change on given date, linking to its history.
+This is the same as {{msg-mw|hist}}, but not abbreviated.
+Three messages are shown side-by-side: ({{msg-mw|nchanges}} |
{{msg-mw|enhancedrc-since-last-visit}} | {{msg-mw|enhancedrc-history}}).',
'recentchanges' => 'The text of the link in sidebar going to the special page
[[Special:RecentChanges]]. Also the page title of that special page.
See also:
diff --git a/maintenance/language/messages.inc
b/maintenance/language/messages.inc
index 68b2d17..a81df71 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -1317,6 +1317,8 @@
),
'recentchanges' => array(
'nchanges',
+ 'enhancedrc-since-last-visit',
+ 'enhancedrc-history',
'recentchanges',
'recentchanges-url',
'recentchanges-legend',
--
To view, visit https://gerrit.wikimedia.org/r/75579
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id74fe88bb2a1879651935ac56e9cdcb2e54b331f
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Isarra <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: TMg <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits