1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00

User Preferences Extender and Tests (#2463)

This commit is contained in:
Alexander Skvortsov
2020-12-04 15:45:08 -05:00
committed by GitHub
parent 641619e820
commit eed407812f
7 changed files with 99 additions and 14 deletions

View File

@@ -9,7 +9,6 @@
namespace Flarum\User;
use Flarum\Event\ConfigureUserPreferences;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\ContainerUtil;
use Flarum\Settings\SettingsRepositoryInterface;
@@ -94,16 +93,8 @@ class UserServiceProvider extends AbstractServiceProvider
$events->subscribe(UserMetadataUpdater::class);
$events->subscribe(UserPolicy::class);
$events->listen(ConfigureUserPreferences::class, [$this, 'configureUserPreferences']);
}
/**
* @param ConfigureUserPreferences $event
*/
public function configureUserPreferences(ConfigureUserPreferences $event)
{
$event->add('discloseOnline', 'boolval', true);
$event->add('indexProfile', 'boolval', true);
$event->add('locale');
User::registerPreference('discloseOnline', 'boolval', true);
User::registerPreference('indexProfile', 'boolval', true);
User::registerPreference('locale');
}
}