1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 10:16:09 +02:00

Move more event classes to appropriate namespaces

This commit is contained in:
Franz Liedke
2017-06-25 17:04:33 +02:00
parent 78f3681fc1
commit f824dcfb53
8 changed files with 16 additions and 16 deletions

View File

@@ -11,7 +11,7 @@
namespace Flarum\User\Command;
use Flarum\Event\AvatarWillBeDeleted;
use Flarum\User\Event\AvatarDeleting;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\UserRepository;
@@ -64,7 +64,7 @@ class DeleteAvatarHandler
$user->changeAvatarPath(null);
$this->events->fire(
new AvatarWillBeDeleted($user, $actor)
new AvatarDeleting($user, $actor)
);
$user->save();

View File

@@ -12,7 +12,7 @@
namespace Flarum\User\Command;
use Exception;
use Flarum\Event\AvatarWillBeSaved;
use Flarum\User\Event\AvatarSaving;
use Flarum\Foundation\Application;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
@@ -110,7 +110,7 @@ class UploadAvatarHandler
file_put_contents($tmpFile, $encodedImage);
$this->events->fire(
new AvatarWillBeSaved($user, $actor, $tmpFile)
new AvatarSaving($user, $actor, $tmpFile)
);
$mount = new MountManager([

View 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\User\Event;
use Flarum\User\User;
class AvatarDeleting
{
/**
* The user whose avatar will be deleted.
*
* @var User
*/
public $user;
/**
* The user performing the action.
*
* @var User
*/
public $actor;
/**
* @param User $user The user whose avatar will be deleted.
* @param User $actor The user performing the action.
*/
public function __construct(User $user, User $actor)
{
$this->user = $user;
$this->actor = $actor;
}
}

View File

@@ -0,0 +1,50 @@
<?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\User\Event;
use Flarum\User\User;
class AvatarSaving
{
/**
* The user whose avatar will be saved.
*
* @var User
*/
public $user;
/**
* The user performing the action.
*
* @var User
*/
public $actor;
/**
* The path to the avatar that will be saved.
*
* @var string
*/
public $path;
/**
* @param User $user The user whose avatar will be saved.
* @param User $actor The user performing the action.
* @param string $path The path to the avatar that will be saved.
*/
public function __construct(User $user, User $actor, $path)
{
$this->user = $user;
$this->actor = $actor;
$this->path = $path;
}
}

View File

@@ -0,0 +1,38 @@
<?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\User\Event;
use Flarum\Search\SearchCriteria;
use Flarum\User\Search\UserSearch;
class Searching
{
/**
* @var \Flarum\User\Search\UserSearch
*/
public $search;
/**
* @var SearchCriteria
*/
public $criteria;
/**
* @param UserSearch $search
* @param SearchCriteria $criteria
*/
public function __construct(UserSearch $search, SearchCriteria $criteria)
{
$this->search = $search;
$this->criteria = $criteria;
}
}

View File

@@ -11,7 +11,7 @@
namespace Flarum\User\Search;
use Flarum\Event\ConfigureUserSearch;
use Flarum\User\Event\Searching;
use Flarum\Search\ApplySearchParametersTrait;
use Flarum\Search\GambitManager;
use Flarum\Search\SearchCriteria;
@@ -69,7 +69,7 @@ class UserSearcher
$this->applyOffset($search, $offset);
$this->applyLimit($search, $limit + 1);
event(new ConfigureUserSearch($search, $criteria));
event(new Searching($search, $criteria));
// Execute the search query and retrieve the results. We get one more
// results than the user asked for, so that we can say if there are more