Don't hardcode admin URL

Fixes #1219.
This commit is contained in:
Franz Liedke 2017-08-04 23:37:59 +02:00
parent 37bc5eea08
commit 1349f146d5
2 changed files with 4 additions and 6 deletions

View File

@ -27783,13 +27783,11 @@ System.register('flarum/components/SessionDropdown', ['flarum/helpers/avatar', '
href: app.route('settings') href: app.route('settings')
}), 50); }), 50);
if (user.groups().some(function (group) { if (app.forum.attribute('adminUrl')) {
return group.id() === Group.ADMINISTRATOR_ID;
})) {
items.add('administration', LinkButton.component({ items.add('administration', LinkButton.component({
icon: 'wrench', icon: 'wrench',
children: app.translator.trans('core.forum.header.admin_button'), children: app.translator.trans('core.forum.header.admin_button'),
href: app.forum.attribute('baseUrl') + '/admin', href: app.forum.attribute('adminUrl'),
target: '_blank', target: '_blank',
config: function config() {} config: function config() {}
}), 0); }), 0);

View File

@ -62,12 +62,12 @@ export default class SessionDropdown extends Dropdown {
50 50
); );
if (user.groups().some(group => group.id() === Group.ADMINISTRATOR_ID)) { if (app.forum.attribute('adminUrl')) {
items.add('administration', items.add('administration',
LinkButton.component({ LinkButton.component({
icon: 'wrench', icon: 'wrench',
children: app.translator.trans('core.forum.header.admin_button'), children: app.translator.trans('core.forum.header.admin_button'),
href: app.forum.attribute('baseUrl') + '/admin', href: app.forum.attribute('adminUrl'),
target: '_blank', target: '_blank',
config: () => {} config: () => {}
}), }),