Skip to content

Commit

Permalink
Fix DomainSnapshot publishing (moving page) and verification of them
Browse files Browse the repository at this point in the history
  • Loading branch information
it-spiderman committed Sep 4, 2024
1 parent 663ebc3 commit c1bd602
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 1 addition & 3 deletions includes/API/WriteStoreWitnessTxHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ public function run() {
if ( !$domainSnapshotPage ) {
throw new HttpException( "No Domain Snapshot page found", 404 );
}
$this->verificationEngine->getLookup()->updateEntity( $domainSnapshotPage, [
'witness_event_id' => $witness_event_id,
] );
$this->verificationEngine->buildAndUpdateVerificationData( $domainSnapshotPage, $domainSnapshotPage->getRevision() );

// Add receipt to the domain snapshot
$this->witnessingEngine->addReceiptToDomainSnapshot( $this->user, $witnessEvent );
Expand Down
4 changes: 2 additions & 2 deletions includes/Verification/VerificationLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ private function getCanonicalTitle( Title $title ): string {
}
$canonicalNamespace = $this->namespaceInfo->getCanonicalName( $title->getNamespace() );
if ( !$canonicalNamespace ) {
return $title->getPrefixedText();
return str_replace( '_', ' ', $title->getPrefixedText() );
}
return "$canonicalNamespace:{$title->getText()}";
return str_replace( '_', ' ', "$canonicalNamespace:{$title->getText()}" );
}

/**
Expand Down
5 changes: 4 additions & 1 deletion includes/Verification/WitnessingEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public function addReceiptToDomainSnapshot( User $user, WitnessEventEntity $enti
throw new \MWException( 'Could not store receipt to Domain Snapshot' );
}

$resRev = $this->revisionStore->getRevisionByTitle( $tentativeTitle );

// Rename from tentative title to final title.
$domainSnapshotVH = $entity->get( 'domain_snapshot_genesis_hash' );
$finalTitle = $this->titleFactory->makeTitle( 6942, "DomainSnapshot:$domainSnapshotVH" );
Expand All @@ -88,8 +90,9 @@ public function addReceiptToDomainSnapshot( User $user, WitnessEventEntity $enti
$createRedirect = false;
$movePage->move( $user, $reason, $createRedirect );
$this->getLookup()->updateWitnessEventEntity( $entity, [
'domain_snapshot_title' => $finalTitle->getPrefixedText(),
'domain_snapshot_title' => str_replace( '_', ' ', $finalTitle->getPrefixedText() ),
] );
return $resRev;
}

/**
Expand Down

0 comments on commit c1bd602

Please sign in to comment.