1
0
mirror of https://github.com/flarum/core.git synced 2025-08-07 17:07:19 +02:00

try to patch up the advanced page

This commit is contained in:
Daniel Klabbers
2021-08-01 00:41:25 +02:00
committed by David Wheatley
parent 731fae666f
commit c1754af74a
3 changed files with 19 additions and 18 deletions

View File

@@ -75,6 +75,7 @@ export default class AdminNav extends Component {
</LinkButton>
);
// We only display the advanced pane when a certain threshold is reached or it is manually activated.
if (app.data.settings['advanced_settings_pane_enabled']) {
items.add(
'advanced',

View File

@@ -7,7 +7,11 @@ export default class AdvancedPage extends AdminPage {
oninit(vnode) {
super.oninit(vnode);
this.queueDrivers = app.data.queueDrivers ?? [];
this.queueDrivers = {};
(app.data.queueDrivers).forEach(driver => {
this.queueDrivers[driver] = app.translator.trans('core.admin.queue.' + driver);
});
}
headerInfo() {
@@ -22,26 +26,13 @@ export default class AdvancedPage extends AdminPage {
content() {
return [
<div className="Form">
{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 }), {}),
options: Object.keys(this.queueDrivers).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

@@ -63,9 +63,14 @@ class QueueServiceProvider extends AbstractServiceProvider
/** @var Queue $driver */
$driver = $container->make($driverClass);
$driver->setContainer($container);
return $driver->build();
// This method only exists on the Laravel abstract Queue implementation, not the contract,
// for simplicity we will try to inject the container if the method is available on the driver.
if (method_exists($driver, 'setContainer')) {
$driver->setContainer($container);
}
return $driver;
});
// Register a simple connection factory that always returns the same
@@ -95,7 +100,7 @@ class QueueServiceProvider extends AbstractServiceProvider
});
// Override the Laravel native Listener, so that we can ignore the environment
// option and force the binary to flarum.
// option and force the binary to Flarum.
$this->container->singleton(QueueListener::class, function (Container $container) {
return new Listener($container->make(Paths::class)->base);
});
@@ -138,6 +143,10 @@ class QueueServiceProvider extends AbstractServiceProvider
);
});
$this->container->when(DatabaseQueue::class)
->needs('$table')
->give('queue_jobs');
$this->container->alias('flarum.queue.connection', Queue::class);
$this->container->alias(ConnectorInterface::class, 'queue.connection');