Skip to content

Commit

Permalink
Anchor the appsbar icon to SiteURL (#347)
Browse files Browse the repository at this point in the history
This ensures the icon can be correctly loaded when a subpath is configured and the application isn't running at the root.

Fixes: #343
  • Loading branch information
lieut-data committed Jan 10, 2023
1 parent 8106e4a commit b45b46e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webapp/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import {getConfig} from 'mattermost-redux/selectors/entities/general';

import SidebarHeader from './components/sidebar_header';
import TeamSidebar from './components/team_sidebar';
import RHSSidebar from './components/rhs_sidebar';
Expand Down Expand Up @@ -69,7 +71,9 @@ class PluginClass {

// App Bar icon
if (registry.registerAppBarComponent) {
const iconURL = `/plugins/${id}/public/app-bar-icon.png`;
const config = getConfig(store.getState());
const siteUrl = (config && config.SiteURL) || '';
const iconURL = `${siteUrl}/plugins/${id}/public/app-bar-icon.png`;
registry.registerAppBarComponent(iconURL, boundToggleRHSAction, 'GitLab');
}
}
Expand Down

0 comments on commit b45b46e

Please sign in to comment.