This commit is contained in:
Daniel Klabbers 2021-07-14 11:50:27 +02:00 committed by David Wheatley
parent 65a5ed4e86
commit 7cd67720d3
No known key found for this signature in database
GPG Key ID: DCC0FCE349280DFF
3 changed files with 25 additions and 14 deletions

View File

@ -1,12 +1,13 @@
import FieldSet from '../../common/components/FieldSet';
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import Alert from "../../common/components/Alert";
export default class AdvancedPage extends AdminPage {
oninit(vnode) {
super.oninit(vnode);
this.queueOptions = [];
this.queueDrivers = app.data.queueDrivers ?? [];
}
headerInfo() {
@ -21,17 +22,26 @@ export default class AdvancedPage extends AdminPage {
content() {
return [
<div className="Form">
{Object.keys(this.queueOptions).length > 1
? [
this.buildSettingComponent({
type: 'select',
setting: 'default_locale',
options: this.localeOptions,
label: app.translator.trans('core.admin.advanced.queue_driver_heading'),
}),
]
: ''}
{this.buildSettingComponent({
type: 'text',
setting: 'mail_from',
label: app.translator.trans('core.admin.advanced.queue_driver_heading'),
className: 'AdvancedPage-QueueSettings',
})}
{this.buildSettingComponent({
type: 'select',
setting: 'queue_driver',
options: Object.keys(this.driverFields).reduce((memo, val) => ({ ...memo, [val]: val }), {}),
label: app.translator.trans('core.admin.queue.driver_heading'),
className: 'AdvancedPage-QueueSettings',
})}
{this.status.sending ||
Alert.component(
{
dismissible: false,
},
app.translator.trans('core.admin.email.not_sending_message')
)}
{this.submitButton()}
</div>,
];

View File

@ -79,6 +79,7 @@ class AdminPayload
$document->payload['slugDrivers'] = array_map(function ($resourceDrivers) {
return array_keys($resourceDrivers);
}, $this->container->make('flarum.http.slugDrivers'));
$document->payload['queueDrivers'] = array_keys($this->container->make('flarum.queue.supported_drivers'));
$document->payload['phpVersion'] = PHP_VERSION;
$document->payload['mysqlVersion'] = $this->db->selectOne('select version() as version')->version;

View File

@ -46,7 +46,7 @@ class QueueServiceProvider extends AbstractServiceProvider
public function register()
{
$this->container->singleton('queue.supported_drivers', function () {
$this->container->singleton('flarum.queue.supported_drivers', function () {
return [
'sync' => SyncQueue::class,
'database' => DatabaseQueue::class,
@ -55,7 +55,7 @@ class QueueServiceProvider extends AbstractServiceProvider
$this->container->singleton('flarum.queue.connection', function (Container $container) {
/** @var array $drivers */
$drivers = $container->make('queue.supported_drivers');
$drivers = $container->make('flarum.queue.supported_drivers');
/** @var SettingsRepositoryInterface $settings */
$settings = $container->make(SettingsRepositoryInterface::class);
$driverName = $settings->get('queue_driver', 'sync');