/**
  * @todo Move this to AbstractBlock and use for summary/header/etc.
  * @param AbstractRevision $revision
  * @return Message
  */
 protected function getDisallowedErrorMessage(AbstractRevision $revision)
 {
     if (in_array($this->action, array('moderate-topic', 'moderate-post'))) {
         /*
          * When failing to moderate an already moderated action (like
          * undo), show the more general "you have insufficient
          * permissions for this action" message, rather than the
          * specialized "this topic is <hidden|deleted|suppressed>" msg.
          */
         return $this->context->msg('flow-error-not-allowed');
     }
     $state = $revision->getModerationState();
     // display simple message
     // i18n messages:
     //  flow-error-not-allowed-hide,
     //  flow-error-not-allowed-reply-to-hide-topic
     //  flow-error-not-allowed-delete
     //  flow-error-not-allowed-reply-to-delete-topic
     //  flow-error-not-allowed-suppress
     //  flow-error-not-allowed-reply-to-suppress-topic
     if ($revision instanceof PostRevision) {
         $type = $revision->isTopicTitle() ? 'topic' : 'post';
     } else {
         $type = $revision->getRevisionType();
     }
     // Show a snippet of the relevant log entry if available.
     if (\LogPage::isLogType($state)) {
         // check if user has sufficient permissions to see log
         $logPage = new \LogPage($state);
         if ($this->context->getUser()->isAllowed($logPage->getRestriction())) {
             // LogEventsList::showLogExtract will write to OutputPage, but we
             // actually just want that text, to write it ourselves wherever we want,
             // so let's create an OutputPage object to then get the content from.
             $rc = new \RequestContext();
             $output = $rc->getOutput();
             // get log extract
             $entries = \LogEventsList::showLogExtract($output, array($state), $this->workflow->getArticleTitle()->getPrefixedText(), '', array('lim' => 10, 'showIfEmpty' => false, 'msgKey' => array(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}-extract"))));
             // check if there were any log extracts
             if ($entries) {
                 $message = new \RawMessage('$1');
                 return $message->rawParams($output->getHTML());
             }
         }
     }
     return $this->context->msg(array("flow-error-not-allowed-{$this->action}-to-{$state}-{$type}", "flow-error-not-allowed-{$state}", "flow-error-not-allowed"));
 }