diff --git a/js/src/admin/components/AdvancedPage.js b/js/src/admin/components/AdvancedPage.js index 01739d60d..d25c4126f 100644 --- a/js/src/admin/components/AdvancedPage.js +++ b/js/src/admin/components/AdvancedPage.js @@ -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 [
- {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()}
, ]; diff --git a/src/Admin/Content/AdminPayload.php b/src/Admin/Content/AdminPayload.php index 8c4237c8e..717bbc05f 100644 --- a/src/Admin/Content/AdminPayload.php +++ b/src/Admin/Content/AdminPayload.php @@ -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; diff --git a/src/Queue/QueueServiceProvider.php b/src/Queue/QueueServiceProvider.php index 5b84e9940..342a45c74 100644 --- a/src/Queue/QueueServiceProvider.php +++ b/src/Queue/QueueServiceProvider.php @@ -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');