Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/205614

Change subject: Fix checks to see if board/workflow has been deleted
......................................................................

Fix checks to see if board/workflow has been deleted

Bug: T95280
Change-Id: Id3f1b37fbede98dfb2e575e4e41e0d9f0fac27cd
---
M includes/Formatter/ContributionsQuery.php
M includes/Model/Workflow.php
M includes/RevisionActionPermissions.php
3 files changed, 9 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/14/205614/1

diff --git a/includes/Formatter/ContributionsQuery.php 
b/includes/Formatter/ContributionsQuery.php
index 1063ee1..3272186 100644
--- a/includes/Formatter/ContributionsQuery.php
+++ b/includes/Formatter/ContributionsQuery.php
@@ -73,10 +73,7 @@
                                try {
                                        $result = $pager instanceof 
ContribsPager ? new ContributionsRow : new DeletedContributionsRow;
                                        $result = $this->buildResult( 
$revision, $pager->getIndexField(), $result );
-                                       // comparing article ID to 0 to check 
if title doesn't currently
-                                       // exist & isDeleted to see if it ever 
existed (but now deleted)
-                                       $title = 
$result->workflow->getOwnerTitle();
-                                       $deleted = 
$result->currentRevision->isDeleted() || ($title->getArticleID() === 0 && 
$title->isDeleted() > 0);
+                                       $deleted = 
$result->currentRevision->isDeleted() || $result->workflow->isDeleted();
 
                                        if (
                                                $result instanceof 
ContributionsRow &&
diff --git a/includes/Model/Workflow.php b/includes/Model/Workflow.php
index fad0f7d..dc78b5b 100644
--- a/includes/Model/Workflow.php
+++ b/includes/Model/Workflow.php
@@ -269,6 +269,13 @@
        public function getType() { return $this->type; }
 
        /**
+        * @return bool
+        */
+       public function isDeleted() {
+               return Title::newFromID( $this->pageId ) !== null;
+       }
+
+       /**
         * Returns true if the workflow is new as of this request (regardless of
         * whether or not is it already saved yet - that's unknown).
         *
diff --git a/includes/RevisionActionPermissions.php 
b/includes/RevisionActionPermissions.php
index b79c276..5aa327d 100644
--- a/includes/RevisionActionPermissions.php
+++ b/includes/RevisionActionPermissions.php
@@ -79,12 +79,7 @@
 
                        if ( $allowed && $revision !== null ) {
                                $workflow = 
$revision->getCollection()->getWorkflow();
-                               $title = $workflow->getOwnerTitle();
-
-                               // if the board is deleted, nothing is allowed
-                               // comparing article ID to 0 to check if title 
doesn't currently
-                               // exist & isDeleted to see if it ever existed 
(but now deleted)
-                               $allowed = $this->user->isAllowed( 
'deletedhistory' ) || $title->getArticleID() !== 0 || $title->isDeleted() === 0;
+                               $allowed = $this->user->isAllowed( 
'deletedhistory' ) || !$workflow->isDeleted();
                        }
                } catch ( InvalidDataException $e ) {
                        // If data is not in storage, just return that 
revision's status

-- 
To view, visit https://gerrit.wikimedia.org/r/205614
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3f1b37fbede98dfb2e575e4e41e0d9f0fac27cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to