diff options
Diffstat (limited to 'Echo/includes/formatters/EventPresentationModel.php')
-rw-r--r-- | Echo/includes/formatters/EventPresentationModel.php | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Echo/includes/formatters/EventPresentationModel.php b/Echo/includes/formatters/EventPresentationModel.php index 02c6e6e8..59a9bfef 100644 --- a/Echo/includes/formatters/EventPresentationModel.php +++ b/Echo/includes/formatters/EventPresentationModel.php @@ -1,5 +1,6 @@ <?php +use MediaWiki\Revision\RevisionRecord; use Wikimedia\Timestamp\TimestampException; /** @@ -143,16 +144,26 @@ abstract class EchoEventPresentationModel implements JsonSerializable { } /** + * Get the distribution type + * + * @return string 'web' or 'email' + */ + final public function getDistributionType() { + return $this->distributionType; + } + + /** * Equivalent to IContextSource::msg for the current * language * + * @param string ...$args * @return Message */ - protected function msg( /* ,,, */ ) { + protected function msg( ...$args ) { /** * @var Message $msg */ - $msg = wfMessage( ...func_get_args() ); + $msg = wfMessage( ...$args ); $msg->inLanguage( $this->language ); // Notifications are considered UI (and should be in UI language, not @@ -257,7 +268,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { /** * Helper for EchoEvent::userCan * - * @param int $type Revision::DELETED_* constant + * @param int $type RevisionRecord::DELETED_* constant * @return bool */ final protected function userCan( $type ) { @@ -282,7 +293,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { return false; } - if ( $this->userCan( Revision::DELETED_USER ) ) { + if ( $this->userCan( RevisionRecord::DELETED_USER ) ) { // Not deleted return [ $this->getTruncatedUsername( $agent ), @@ -409,6 +420,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { */ public function getSubjectMessage() { $msg = $this->getMessageWithAgent( $this->getSubjectMessageKey() ); + $msg->params( $this->getViewingUserForGender() ); if ( $msg->isDisabled() ) { // Back-compat for models that haven't been updated yet $msg = $this->getHeaderMessage(); @@ -467,7 +479,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { * Array of secondary link details, including possibly-relative URLs, label, * description & icon name. * - * @return array Array of links in the format of: + * @return (null|array)[] Array of links in the format of: * [['url' => (string) url, * 'label' => (string) link text (non-escaped), * 'description' => (string) descriptive text (optional, non-escaped), @@ -564,7 +576,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { return null; } - if ( !$this->userCan( Revision::DELETED_USER ) ) { + if ( !$this->userCan( RevisionRecord::DELETED_USER ) ) { return null; } @@ -620,7 +632,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { * Get a dynamic action link * * @param Title $title Title relating to this action - * @param bool $icon Optional. Symbolic name of the OOUI icon to use + * @param string|false $icon Optional. Symbolic name of the OOUI icon to use * @param string $label link text (non-escaped) * @param string|null $description descriptive text (optional, non-escaped) * @param array $data Action data @@ -714,7 +726,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable { $this->getTruncatedTitleText( $title ), $title->getFullURL( [ 'action' => $availableAction ] ), $this->getUser()->getName() - ), + )->escaped(), null, $data, [ 'action' => $availableAction ] |