| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
namespace MediaWiki\Extension\DiscussionTools\Notifications; |
| 11 |
|
| 12 |
class AddedTopicPresentationModel extends SubscribedNewCommentPresentationModel { |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
public function getPrimaryLink() { |
| 18 |
return [ |
| 19 |
'url' => $this->getCommentLink() ?: $this->section->getTitleWithSection()->getFullURL(), |
| 20 |
'label' => $this->msg( 'discussiontools-notification-added-topic-view' )->text() |
| 21 |
]; |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
protected function getHeaderMessageKey() { |
| 28 |
if ( $this->isBundled() ) { |
| 29 |
return 'discussiontools-notification-added-topic-header-bundled'; |
| 30 |
} else { |
| 31 |
return 'discussiontools-notification-added-topic-header'; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public function getHeaderMessage() { |
| 39 |
if ( $this->isBundled() ) { |
| 40 |
$count = $this->getNotificationCountForOutput(); |
| 41 |
$msg = $this->msg( $this->getHeaderMessageKey() ); |
| 42 |
|
| 43 |
$msg->numParams( $count ); |
| 44 |
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); |
| 45 |
return $msg; |
| 46 |
} else { |
| 47 |
$msg = parent::getHeaderMessage(); |
| 48 |
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); |
| 49 |
$msg->plaintextParams( $this->section->getTruncatedSectionTitle() ); |
| 50 |
return $msg; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public function getCompactHeaderMessage() { |
| 58 |
$msg = $this->getMessageWithAgent( 'discussiontools-notification-added-topic-header-compact' ); |
| 59 |
$msg->plaintextParams( $this->section->getTruncatedSectionTitle() ); |
| 60 |
$msg->plaintextParams( $this->getContentSnippet() ); |
| 61 |
return $msg; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
protected function getUnsubscribeConfirmationMessageKeys() { |
| 68 |
return [ |
| 69 |
'title' => 'discussiontools-newtopicssubscription-notify-unsubscribed-title', |
| 70 |
'description' => 'discussiontools-newtopicssubscription-notify-unsubscribed-body', |
| 71 |
]; |
| 72 |
} |
| 73 |
} |