Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a0dc5d2

Browse files
committed
Honour user-selected background image from settings
Fixes element-hq/element-web#18705 This is provided as an easter egg, but more importantly as an a11y workaround.
1 parent 32343f3 commit a0dc5d2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/components/structures/LoggedInView.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/*
2-
Copyright 2015, 2016 OpenMarket Ltd
3-
Copyright 2017 Vector Creations Ltd
4-
Copyright 2017, 2018, 2020 New Vector Ltd
2+
Copyright 2015 - 2021 The Matrix.org Foundation C.I.C.
53
64
Licensed under the Apache License, Version 2.0 (the "License");
75
you may not use this file except in compliance with the License.
@@ -70,6 +68,7 @@ import SpaceStore from "../../stores/SpaceStore";
7068
import classNames from 'classnames';
7169
import GroupFilterPanel from './GroupFilterPanel';
7270
import CustomRoomTagPanel from './CustomRoomTagPanel';
71+
import { mediaFromMxc } from "../../customisations/Media";
7372

7473
// We need to fetch each pinned message individually (if we don't already have it)
7574
// so each pinned message may trigger a request. Limit the number per room for sanity.
@@ -223,9 +222,14 @@ class LoggedInView extends React.Component<IProps, IState> {
223222
}
224223

225224
private refreshBackgroundImage = async (): Promise<void> => {
226-
this.setState({
227-
backgroundImage: OwnProfileStore.instance.getHttpAvatarUrl(),
228-
});
225+
let backgroundImage = SettingsStore.getValue("RoomList.backgroundImage");
226+
if (backgroundImage) {
227+
// convert to http before going much further
228+
backgroundImage = mediaFromMxc(backgroundImage).srcHttp;
229+
} else {
230+
backgroundImage = OwnProfileStore.instance.getHttpAvatarUrl();
231+
}
232+
this.setState({ backgroundImage });
229233
};
230234

231235
private onAction = (payload): void => {

0 commit comments

Comments
 (0)