jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/150210 )
Change subject: Special:Newpages feed now shows first revision instead of
latest revision
......................................................................
Special:Newpages feed now shows first revision instead of latest revision
Bug: T69026
Change-Id: I1f794f314319127848a4e9981c7d4f549fb4fd0f
---
M includes/specials/SpecialNewpages.php
1 file changed, 17 insertions(+), 9 deletions(-)
Approvals:
Florianschmidtwelzow: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialNewpages.php
b/includes/specials/SpecialNewpages.php
index be8ad8f..2c39331 100644
--- a/includes/specials/SpecialNewpages.php
+++ b/includes/specials/SpecialNewpages.php
@@ -294,6 +294,19 @@
}
/**
+ * @param stdClass $row Result row from recent changes
+ * @return Revision|bool
+ */
+ protected function revisionFromRcResult( stdClass $result ) {
+ return new Revision( [
+ 'comment' => $result->rc_comment,
+ 'deleted' => $result->rc_deleted,
+ 'user_text' => $result->rc_user_text,
+ 'user' => $result->rc_user,
+ ] );
+ }
+
+ /**
* Format a row, providing the timestamp, links to the page/history,
* size, user links, and a comment
*
@@ -303,14 +316,9 @@
public function formatRow( $result ) {
$title = Title::newFromRow( $result );
- # Revision deletion works on revisions, so we should cast one
- $row = [
- 'comment' => $result->rc_comment,
- 'deleted' => $result->rc_deleted,
- 'user_text' => $result->rc_user_text,
- 'user' => $result->rc_user,
- ];
- $rev = new Revision( $row );
+ // Revision deletion works on revisions,
+ // so cast our recent change row to a revision row.
+ $rev = $this->revisionFromRcResult( $result );
$rev->setTitle( $title );
$classes = [];
@@ -477,7 +485,7 @@
}
protected function feedItemDesc( $row ) {
- $revision = Revision::newFromId( $row->rev_id );
+ $revision = $this->revisionFromRcResult( $row );
if ( $revision ) {
// XXX: include content model/type in feed item?
return '<p>' . htmlspecialchars(
$revision->getUserText() ) .
--
To view, visit https://gerrit.wikimedia.org/r/150210
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1f794f314319127848a4e9981c7d4f549fb4fd0f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Rohan013 <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: SPQRobin <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits