mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-23 16:06:53 +00:00
Handle hidden revision in more places
Instead of checking section->exists() everywhere we have to call getTruncatedSectionTitle(), override the method inside PlaintextEchoPresentationModelSection class to make it always return string for our case. Call to getTruncatedSectionTitle() in the following classes now use the method override: * RemovedTopicPresentationModel * SubscribedNewCommentPresentationModel * AddedTopicPresentationModel The call to getTruncatedSectionTitle() in CommentThanksPresentationModel does not need nor use the override. Bug: T378261 Change-Id: Ibe985da5c1a79c5a1853d9c4896f8769cce6ddfd
This commit is contained in:
parent
f631ba47ad
commit
ad99faef19
|
@ -48,4 +48,18 @@ class PlaintextEchoPresentationModelSection extends EchoPresentationModelSection
|
|||
}
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get truncated section title, according to user's language
|
||||
* or a placeholder text if the section title is not available.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTruncatedSectionTitle() {
|
||||
if ( $this->exists() ) {
|
||||
return parent::getTruncatedSectionTitle();
|
||||
}
|
||||
|
||||
return wfMessage( 'discussiontools-notification-topic-hidden' )->inLanguage( $this->language )->text();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,15 +90,11 @@ class SubscribedNewCommentPresentationModel extends EchoEventPresentationModel {
|
|||
$msg = $this->msg( $this->getHeaderMessageKey() );
|
||||
// Repeat is B/C until unused parameter is removed from translations
|
||||
$msg->numParams( $count, $count );
|
||||
$msg->plaintextParams( $this->section->getTruncatedSectionTitle() );
|
||||
} else {
|
||||
$msg = parent::getHeaderMessage();
|
||||
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
|
||||
}
|
||||
|
||||
if ( $this->section->exists() ) {
|
||||
$msg->plaintextParams( $this->section->getTruncatedSectionTitle() );
|
||||
} else {
|
||||
$msg->plaintextParams( $this->msg( 'discussiontools-notification-topic-hidden' )->text() );
|
||||
}
|
||||
|
||||
return $msg;
|
||||
|
|
Loading…
Reference in a new issue