Add alert if nicknames display name driver not enabled

This commit is contained in:
Alexander Skvortsov 2020-12-07 15:46:16 -05:00
parent ffbb37e956
commit 54f7a41c49

View File

@ -1,6 +1,20 @@
import Alert from 'flarum/common/components/Alert';
import Link from 'flarum/common/components/Link';
app.initializers.add('flarum/nicknames', () => { app.initializers.add('flarum/nicknames', () => {
app.extensionData app.extensionData
.for('flarum-nicknames') .for('flarum-nicknames')
.registerSetting(function () {
if (app.data.settings.display_name_driver === 'nickname') return;
return (
<div className="Form-group">
<Alert dismissible={false}>
{app.translator.trans('flarum-nicknames.admin.wrong_driver', {a: <Link href={app.route('basics')}></Link>})}
</Alert>
</div>
);
})
.registerSetting({ .registerSetting({
setting: 'flarum-nicknames.unique', setting: 'flarum-nicknames.unique',
type: 'boolean', type: 'boolean',