mirror of
https://github.com/flarum/core.git
synced 2025-10-18 10:16:09 +02:00
making posts and discussions private (#1153)
* flagrow/byobu#11 making posts and discussions private * tested migrations and tested setting is_private on discussion and post manually * added phpdoc for Post and Discussion and added the casting for these attributes * satisfying styleci * fixes for review * added new private discussion event and included it in the access policy * added new private post event and included it in the access policy
This commit is contained in:
committed by
Toby Zerner
parent
4c0339c30e
commit
04c4806f6f
41
src/Event/ScopePrivateDiscussionVisibility.php
Normal file
41
src/Event/ScopePrivateDiscussionVisibility.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopePrivateDiscussionVisibility` event.
|
||||
*/
|
||||
class ScopePrivateDiscussionVisibility
|
||||
{
|
||||
/**
|
||||
* @var Builder
|
||||
*/
|
||||
public $query;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
public $actor;
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param User $actor
|
||||
*/
|
||||
public function __construct(Builder $query, User $actor)
|
||||
{
|
||||
$this->query = $query;
|
||||
$this->actor = $actor;
|
||||
}
|
||||
}
|
49
src/Event/ScopePrivatePostVisibility.php
Normal file
49
src/Event/ScopePrivatePostVisibility.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopePrivatePostVisibility` event.
|
||||
*/
|
||||
class ScopePrivatePostVisibility
|
||||
{
|
||||
/**
|
||||
* @var Discussion
|
||||
*/
|
||||
public $discussion;
|
||||
|
||||
/**
|
||||
* @var Builder
|
||||
*/
|
||||
public $query;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
public $actor;
|
||||
|
||||
/**
|
||||
* @param Discussion $discussion
|
||||
* @param Builder $query
|
||||
* @param User $actor
|
||||
*/
|
||||
public function __construct(Discussion $discussion, Builder $query, User $actor)
|
||||
{
|
||||
$this->discussion = $discussion;
|
||||
$this->query = $query;
|
||||
$this->actor = $actor;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user