Ejemplo n.º 1
0
 /**
  * @param string $moderationName
  *
  * @param string $contentName
  * @param int    $contentId
  *
  * @return \Illuminate\View\View
  */
 public function renderModerationButton($moderationName, $contentName, $contentId)
 {
     $moderation = $this->moderationRegistry->get($moderationName);
     if ($moderation && $this->permissionChecker->hasPermission('user', null, $moderation->getPermissionName())) {
         return view('partials.moderation.moderation_button', ['moderation' => $moderation, 'content_name' => $contentName, 'content_id' => $contentId]);
     }
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 public function description()
 {
     $moderation = $this->moderationRegistry->get($this->getWrappedObject()->moderation);
     $moderation = $this->presenterDecorator->decorate($moderation);
     $content = $this->getContentForSubjects($this->getWrappedObject()->subjects()->get()->all());
     if ($this->getWrappedObject()->is_reverse) {
         $description = $moderation->reverseDescribe($content, $this->getSourceFromLog($this->getWrappedObject()), $this->getDestinationFromLog($this->getWrappedObject()));
     } else {
         $description = $moderation->describe($content, $this->getSourceFromLog($this->getWrappedObject()), $this->getDestinationFromLog($this->getWrappedObject()));
     }
     return $this->getUserProfileLink($this->getWrappedObject()->user) . ' ' . $description;
 }
Ejemplo n.º 3
0
 public function testAddedModerationIsRetrievableByKey()
 {
     $moderation = Mockery::mock('MyBB\\Core\\Moderation\\ModerationInterface');
     $moderation->shouldReceive('getKey')->withNoArgs()->andReturn('key');
     $registry = new ModerationRegistry();
     $registry->addModeration($moderation);
     static::assertEquals($moderation, $registry->get('key'));
 }
Ejemplo n.º 4
0
 /**
  * @param string $name
  *
  * @return ModerationInterface
  */
 public function getModerationByName($name)
 {
     return $this->moderationRegistry->get($name);
 }