summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2019-04-11 12:08:10 -0400
committerBrian Evans <grknight@gentoo.org>2019-04-11 12:08:10 -0400
commit0fade6b8594219568c87e08834290cda3f6356af (patch)
treea11ca46a29dc53d2335de074b00416158490b5be /Echo/includes/formatters/MentionInSummaryPresentationModel.php
parentCommentStreams: Include minor fixes from upstream (diff)
downloadextensions-0fade6b8594219568c87e08834290cda3f6356af.tar.gz
extensions-0fade6b8594219568c87e08834290cda3f6356af.tar.bz2
extensions-0fade6b8594219568c87e08834290cda3f6356af.zip
Update Echo for 1.32
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'Echo/includes/formatters/MentionInSummaryPresentationModel.php')
-rw-r--r--Echo/includes/formatters/MentionInSummaryPresentationModel.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/Echo/includes/formatters/MentionInSummaryPresentationModel.php b/Echo/includes/formatters/MentionInSummaryPresentationModel.php
new file mode 100644
index 00000000..bda17118
--- /dev/null
+++ b/Echo/includes/formatters/MentionInSummaryPresentationModel.php
@@ -0,0 +1,59 @@
+<?php
+
+class EchoMentionInSummaryPresentationModel extends EchoEventPresentationModel {
+
+ public function getIconType() {
+ return 'mention';
+ }
+
+ public function canRender() {
+ return (bool)$this->event->getTitle();
+ }
+
+ public function getHeaderMessage() {
+ $msg = $this->getMessageWithAgent( 'notification-header-mention-summary' );
+ $msg->params( $this->getViewingUserForGender() );
+ $msg->params( $this->getTruncatedTitleText( $this->event->getTitle() ) );
+
+ return $msg;
+ }
+
+ public function getBodyMessage() {
+ if ( $this->userCan( Revision::DELETED_COMMENT ) ) {
+ $revision = $this->event->getRevision();
+ $summary = $revision->getComment();
+ $summary = Linker::formatComment( $summary );
+ $summary = Sanitizer::stripAllTags( $summary );
+
+ $msg = $this->msg( 'notification-body-mention' )
+ ->plaintextParams( $summary );
+ return $msg;
+ } else {
+ return false;
+ }
+ }
+
+ public function getPrimaryLink() {
+ return [
+ 'url' => $this->getDiffURL(),
+ 'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )->text(),
+ ];
+ }
+
+ public function getSecondaryLinks() {
+ return [ $this->getAgentLink() ];
+ }
+
+ protected function getSubjectMessageKey() {
+ return 'notification-mention-email-subject';
+ }
+
+ private function getDiffURL() {
+ $title = $this->event->getTitle();
+
+ return $title->getLocalURL( [
+ 'oldid' => 'prev',
+ 'diff' => $this->event->getExtraParam( 'revid' )
+ ] );
+ }
+}