/**
  * Returns a revision snippet
  * @param EchoEvent $event The event that the notification is for.
  * @param User $user The user to format the notification for.
  * @return String The revision snippet (or empty string)
  */
 public function getRevisionSnippet($event, $user)
 {
     $extra = $event->getExtra();
     if (!isset($extra['section-text']) || !$event->userCan(Revision::DELETED_TEXT, $user)) {
         return '';
     }
     $snippet = trim($extra['section-text']);
     return $snippet;
 }
예제 #2
0
 /**
  * Extract the subject anchor (linkable portion of the edited page) from
  * the event.
  *
  * @param $event EchoEvent The event to format the subject anchor of
  * @return string The anchor on page, or an empty string
  */
 protected function formatSubjectAnchor(EchoEvent $event)
 {
     global $wgParser, $wgUser;
     if (!$event->userCan(Revision::DELETED_TEXT, $wgUser)) {
         return $this->getMessage('echo-rev-deleted-text-view')->text();
     }
     $extra = $event->getExtra();
     if (empty($extra['section-title'])) {
         return '';
     }
     // Strip out #, keeping # in the i18n message makes it look more clear
     return substr($wgParser->guessLegacySectionNameFromWikiText($extra['section-title']), 1);
 }