Skip to content

Commit

Permalink
Fix viewing other user reviews (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
krisfield authored and jamesmontalvo3 committed Feb 20, 2019
1 parent 3382a1c commit 0adea58
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 2 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"pendingreviews-timediff-just-now": "Changed just now",
"pendingreviews-no-revisions": "No page content changes",
"pendingreviews-num-reviews": "You have $1 pending {{PLURAL:$1|review|reviews}}",
"pendingreviews-num-reviews-complete": "Congrats! You completed your reviews." ,
"pendingreviews-num-reviews-complete": "Congrats! You completed your reviews.",
"pendingreviews-num-other-user-reviews": "$1 has $2 pending {{PLURAL:$2|review|reviews}}",
"pendingreviews-num-approvals": "/$1 pending {{PLURAL:$1|approval|approvals}}.",
"pendingreviews-reviewer-criticality-danger": "Pages reviewed by 0 - {{PLURAL:$1|1 person|$1 people}}",
"pendingreviews-reviewer-criticality-danger-zero": "Pages reviewed by 0 people",
Expand Down
26 changes: 16 additions & 10 deletions specials/SpecialPendingReviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function __construct() {
* @return bool
*/
public function execute( $parser = null ) {
global $wgOut, $wgUser;
global $wgOut;

$this->setHeaders();

Expand Down Expand Up @@ -128,7 +128,7 @@ public function execute( $parser = null ) {
// Check that Approved Revs is installed
$useApprovedRevs = class_exists( 'ApprovedRevs' );

$html = $this->getPageHeader( $wgUser, $useApprovedRevs );
$html = $this->getPageHeader( $this->mUser, $useApprovedRevs );

$html .= '<table class="pendingreviews-list">';
$rowCount = 0;
Expand Down Expand Up @@ -660,10 +660,7 @@ public function getPageHeader( User $user, $useApprovedRevs ) {
$prevReviewSet = max( [ 0, $this->reviewOffset - $this->reviewLimit ] );
$currentURL = $this->getPageTitle()->getLocalUrl();

$viewingUser = '';
// if ( $this->mUser ) {
// $viewingUser = '&user='.$this->mUser;
// }
$viewingUser = '&user=' . $this->mUser;

$linkClass = "pendingreviews-nav-link";
if ( $this->reviewOffset == 0 ) {
Expand Down Expand Up @@ -695,13 +692,22 @@ public function getPageHeader( User $user, $useApprovedRevs ) {
wfMessage( 'watchanalytics-pendingreviews-next-revisions' )->text()
);

if ( $numPendingReviews != 0 ) {
// message like "You have X pending reviews"
$html .= '<h3>' . wfMessage( 'pendingreviews-num-reviews', $numPendingReviews, $this->reviewLimit )->text() . '</h3>';
$html .= '<h3>';

if ( !( $this->getRequest()->getVal( 'user' ) ) ) {
if ( $numPendingReviews != 0 ) {
// message like "You have X pending reviews"
$html .= wfMessage( 'pendingreviews-num-reviews', $numPendingReviews )->text();
} else {
// message like "Congrats you finished your reviews!"
$html .= wfMessage( 'pendingreviews-num-reviews-complete' )->text();
}
} else {
$html .= ' <br /> <big>' . wfMessage( 'pendingreviews-num-reviews-complete' )->text() . '</big>';
$html .= wfMessage( 'pendingreviews-num-other-user-reviews', $user, $numPendingReviews )->text();
}

$html .= '</h3>';

return $html;
}

Expand Down

0 comments on commit 0adea58

Please sign in to comment.