summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Thanks/includes/EchoCoreThanksPresentationModel.php')
-rw-r--r--Thanks/includes/EchoCoreThanksPresentationModel.php33
1 files changed, 16 insertions, 17 deletions
diff --git a/Thanks/includes/EchoCoreThanksPresentationModel.php b/Thanks/includes/EchoCoreThanksPresentationModel.php
index 514b14a8..7360cf84 100644
--- a/Thanks/includes/EchoCoreThanksPresentationModel.php
+++ b/Thanks/includes/EchoCoreThanksPresentationModel.php
@@ -1,13 +1,20 @@
<?php
+
+use MediaWiki\Revision\RevisionRecord;
+
class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
/** @var LogEntry|bool|null */
private $logEntry;
public function canRender() {
$hasTitle = (bool)$this->event->getTitle();
- if ( $this->getThankType() === 'log' ) {
+ if ( $hasTitle && $this->getThankType() === 'log' ) {
$logEntry = $this->getLogEntry();
- return $hasTitle && $logEntry && !$logEntry->getDeleted();
+ return $logEntry && !(
+ // the notification renders the message on Special:Log without the comment,
+ // so check $logEntry is not deleted, or only its comment is deleted
+ $logEntry->getDeleted() & ~LogPage::DELETED_COMMENT
+ );
}
return $hasTitle;
}
@@ -56,22 +63,17 @@ class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
}
private function getRevisionEditSummary() {
- if ( !$this->userCan( Revision::DELETED_COMMENT ) ) {
- return false;
- }
-
- $revId = $this->event->getExtraParam( 'revid', false );
- if ( !$revId ) {
+ if ( !$this->userCan( RevisionRecord::DELETED_COMMENT ) ) {
return false;
}
- $revision = Revision::newFromId( $revId );
+ $revision = $this->event->getRevision();
if ( !$revision ) {
return false;
}
- $summary = $revision->getComment( Revision::RAW );
- return $summary ?: false;
+ $summary = $revision->getComment( RevisionRecord::RAW );
+ return $summary ? $summary->text : false;
}
/**
@@ -98,7 +100,7 @@ class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
return $summary;
}
// Fallback on edit excerpt.
- if ( $this->userCan( Revision::DELETED_TEXT ) ) {
+ if ( $this->userCan( RevisionRecord::DELETED_TEXT ) ) {
return $this->event->getExtraParam( 'excerpt', false );
}
}
@@ -124,7 +126,7 @@ class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
}
public function getSecondaryLinks() {
- $pageLink = $this->getPageLink( $this->event->getTitle(), null, true );
+ $pageLink = $this->getPageLink( $this->event->getTitle(), '', true );
if ( $this->isBundled() ) {
return [ $pageLink ];
} else {
@@ -143,10 +145,7 @@ class EchoCoreThanksPresentationModel extends EchoEventPresentationModel {
if ( !$logId ) {
$this->logEntry = false;
} else {
- $this->logEntry = DatabaseLogEntry::newFromId( $logId, wfGetDB( DB_REPLICA ) );
- if ( !$this->logEntry ) {
- $this->logEntry = false;
- }
+ $this->logEntry = DatabaseLogEntry::newFromId( $logId, wfGetDB( DB_REPLICA ) ) ?: false;
}
return $this->logEntry;
}