mirror of
https://github.com/flarum/framework.git
synced 2025-02-24 16:37:40 +08:00
Merge pull request #27 from flarum/analysis-8wjM79
Applied fixes from StyleCI
This commit is contained in:
commit
1d697a6318
@ -23,7 +23,6 @@ use Illuminate\Database\Query\Expression;
|
||||
|
||||
class DiscussionPolicy extends AbstractPolicy
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -73,7 +72,7 @@ class DiscussionPolicy extends AbstractPolicy
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if ($tag->is_restricted) {
|
||||
if ($actor->hasPermission('tag' . $tag->id . '.discussion.' . $ability)) {
|
||||
if ($actor->hasPermission('tag'.$tag->id.'.discussion.'.$ability)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
@ -39,7 +39,7 @@ class TagPolicy extends AbstractPolicy
|
||||
public function startDiscussion(User $actor, Tag $tag)
|
||||
{
|
||||
if ((! $tag->is_restricted && $actor->hasPermission('startDiscussion'))
|
||||
|| $actor->hasPermission('tag' . $tag->id . '.startDiscussion')) {
|
||||
|| $actor->hasPermission('tag'.$tag->id.'.startDiscussion')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -20,7 +21,7 @@ use Tobscure\JsonApi\Document;
|
||||
class CreateTagController extends AbstractCreateController
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $serializer = TagSerializer::class;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -20,7 +21,7 @@ use Tobscure\JsonApi\Document;
|
||||
class UpdateTagController extends AbstractResourceController
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $serializer = TagSerializer::class;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -54,7 +55,7 @@ class TagSerializer extends AbstractSerializer
|
||||
*/
|
||||
protected function parent($tag)
|
||||
{
|
||||
return $this->hasOne($tag, TagSerializer::class);
|
||||
return $this->hasOne($tag, self::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -10,8 +11,8 @@
|
||||
|
||||
namespace Flarum\Tags\Listener;
|
||||
|
||||
use Flarum\Tags\Api\Controller;
|
||||
use Flarum\Event\ConfigureApiRoutes;
|
||||
use Flarum\Tags\Api\Controller;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class AddTagsApi
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -51,8 +52,8 @@ class DiscussionTaggedPost extends AbstractEventPost implements MergeableInterfa
|
||||
/**
|
||||
* Create a new instance in reply to a discussion.
|
||||
*
|
||||
* @param integer $discussionId
|
||||
* @param integer $userId
|
||||
* @param int $discussionId
|
||||
* @param int $userId
|
||||
* @param array $oldTagIds
|
||||
* @param array $newTagIds
|
||||
* @return static
|
||||
@ -61,10 +62,10 @@ class DiscussionTaggedPost extends AbstractEventPost implements MergeableInterfa
|
||||
{
|
||||
$post = new static;
|
||||
|
||||
$post->content = static::buildContent($oldTagIds, $newTagIds);
|
||||
$post->time = time();
|
||||
$post->content = static::buildContent($oldTagIds, $newTagIds);
|
||||
$post->time = time();
|
||||
$post->discussion_id = $discussionId;
|
||||
$post->user_id = $userId;
|
||||
$post->user_id = $userId;
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@ class Tag extends AbstractModel
|
||||
{
|
||||
$tag = new static;
|
||||
|
||||
$tag->name = $name;
|
||||
$tag->slug = $slug;
|
||||
$tag->name = $name;
|
||||
$tag->slug = $slug;
|
||||
$tag->description = $description;
|
||||
$tag->color = $color;
|
||||
$tag->is_hidden = (bool) $isHidden;
|
||||
$tag->color = $color;
|
||||
$tag->is_hidden = (bool) $isHidden;
|
||||
|
||||
return $tag;
|
||||
}
|
||||
@ -112,7 +112,7 @@ class Tag extends AbstractModel
|
||||
*/
|
||||
public function setLastDiscussion(Discussion $discussion)
|
||||
{
|
||||
$this->last_time = $discussion->last_time;
|
||||
$this->last_time = $discussion->last_time;
|
||||
$this->last_discussion_id = $discussion->id;
|
||||
|
||||
return $this;
|
||||
@ -135,7 +135,7 @@ class Tag extends AbstractModel
|
||||
$hasGlobalPermission = $user->hasPermission($permission);
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if (($hasGlobalPermission && ! $tag->is_restricted) || $user->hasPermission('tag' . $tag->id . '.' . $permission)) {
|
||||
if (($hasGlobalPermission && ! $tag->is_restricted) || $user->hasPermission('tag'.$tag->id.'.'.$permission)) {
|
||||
$ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ class Tag extends AbstractModel
|
||||
$hasGlobalPermission = $user->hasPermission($permission);
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if (($tag->is_restricted || ! $hasGlobalPermission) && ! $user->hasPermission('tag' . $tag->id . '.' . $permission)) {
|
||||
if (($tag->is_restricted || ! $hasGlobalPermission) && ! $user->hasPermission('tag'.$tag->id.'.'.$permission)) {
|
||||
$ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -50,7 +51,7 @@ class TagRepository
|
||||
*
|
||||
* @param string $slug
|
||||
* @param User|null $user
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getIdForSlug($slug, User $user = null)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user