mirror of
https://github.com/flarum/core.git
synced 2025-10-13 07:54:25 +02:00
Use drivers for display names, add display name extender (#2174)
* Deprecate GetDisplayName event * Add interface for display name driver * Add username driver as default * Add code to register supported drivers / used driver as singletons * Configured User class to use new driver-based system for display names * Add extender for adding display name driver * Add integration test for user display name driver * Add frontend UI for selecting display name driver
This commit is contained in:
committed by
GitHub
parent
998e32c208
commit
b0822df759
@@ -14,12 +14,18 @@ use Flarum\Frontend\Document;
|
||||
use Flarum\Group\Permission;
|
||||
use Flarum\Settings\Event\Deserializing;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class AdminPayload
|
||||
{
|
||||
/**
|
||||
* @var Container;
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var SettingsRepositoryInterface
|
||||
*/
|
||||
@@ -36,13 +42,20 @@ class AdminPayload
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @param Container $container
|
||||
* @param SettingsRepositoryInterface $settings
|
||||
* @param ExtensionManager $extensions
|
||||
* @param ConnectionInterface $db
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function __construct(SettingsRepositoryInterface $settings, ExtensionManager $extensions, ConnectionInterface $db, Dispatcher $events)
|
||||
{
|
||||
public function __construct(
|
||||
Container $container,
|
||||
SettingsRepositoryInterface $settings,
|
||||
ExtensionManager $extensions,
|
||||
ConnectionInterface $db,
|
||||
Dispatcher $events
|
||||
) {
|
||||
$this->container = $container;
|
||||
$this->settings = $settings;
|
||||
$this->extensions = $extensions;
|
||||
$this->db = $db;
|
||||
@@ -61,6 +74,8 @@ class AdminPayload
|
||||
$document->payload['permissions'] = Permission::map();
|
||||
$document->payload['extensions'] = $this->extensions->getExtensions()->toArray();
|
||||
|
||||
$document->payload['displayNameDrivers'] = array_keys($this->container->make('flarum.user.display_name.supported_drivers'));
|
||||
|
||||
$document->payload['phpVersion'] = PHP_VERSION;
|
||||
$document->payload['mysqlVersion'] = $this->db->selectOne('select version() as version')->version;
|
||||
}
|
||||
|
Reference in New Issue
Block a user