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