1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-27 08:31:20 +02:00

Respect the mattermost icon when focalboard is used as a plugin (#1185)

This commit is contained in:
Jesús Espino 2021-09-10 22:34:26 +02:00 committed by GitHub
parent 6ad11e072b
commit fae2ac150e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 15 deletions

View File

@ -66,7 +66,6 @@ type Props = {
}
const MainApp = (props: Props) => {
const [faviconStored, setFaviconStored] = useState(false)
wsClient.initPlugin(manifest.id, props.webSocketClient)
useEffect(() => {
@ -84,24 +83,11 @@ const MainApp = (props: Props) => {
}
}, [])
useEffect(() => {
const oldLinks = document.querySelectorAll("link[rel*='icon']") as NodeListOf<HTMLLinkElement>
if (!oldLinks) {
return () => null
}
setFaviconStored(true)
return () => {
document.querySelectorAll("link[rel*='icon']").forEach((n) => n.remove())
oldLinks.forEach((link) => document.getElementsByTagName('head')[0].appendChild(link))
}
}, [])
return (
<ErrorBoundary>
<ReduxProvider store={store}>
<div id='focalboard-app'>
{faviconStored && <App/>}
<App/>
</div>
<div id='focalboard-root-portal'/>
</ReduxProvider>

View File

@ -247,6 +247,11 @@ class Utils {
// favicon
static setFavicon(icon?: string): void {
if (Utils.isFocalboardPlugin()) {
// Do not change the icon from focalboard plugin
return
}
if (!icon) {
document.querySelector("link[rel*='icon']")?.remove()
return