1
0
mirror of https://github.com/flarum/core.git synced 2025-07-14 13:26:23 +02:00

Cleanup some code and fix alert dismiss not working

This commit is contained in:
David Sevilla Martin
2019-11-06 17:20:53 -05:00
committed by David Sevilla Martín
parent c87ebaef08
commit 54c5c09693

View File

@ -330,12 +330,14 @@ export default class Application {
children = app.translator.trans('core.lib.error.generic_message'); children = app.translator.trans('core.lib.error.generic_message');
} }
const isDebug = app.forum.attribute('debug');
error.alert = new Alert({ error.alert = new Alert({
type: 'error', type: 'error',
children, children,
controls: app.forum.attribute('debug') ? [ controls: isDebug && [
<Button className="Button Button--link" onclick={this.showDebug.bind(this, error)}>Debug</Button> <Button className="Button Button--link" onclick={this.showDebug.bind(this, error)}>Debug</Button>
] : undefined ]
}); });
try { try {
@ -355,7 +357,7 @@ export default class Application {
* @private * @private
*/ */
showDebug(error) { showDebug(error) {
this.alerts.dismiss(this.requestErrorAlert); this.alerts.dismiss(this.requestError.alert);
this.modal.show(new RequestErrorModal({error})); this.modal.show(new RequestErrorModal({error}));
} }