Skip to content

Commit

Permalink
Honour default_url_params from user_infos when falling back to defaul…
Browse files Browse the repository at this point in the history
… theme
  • Loading branch information
manisandro committed Mar 7, 2024
1 parent 4eaef07 commit f9c61ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions components/StandardApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class AppInitComponent extends React.Component {
setCurrentTheme: PropTypes.func,
setStartupParameters: PropTypes.func,
showNotification: PropTypes.func,
themesLoaded: PropTypes.func
themesLoaded: PropTypes.func,
userInfos: PropTypes.object
};
constructor(props) {
super(props);
Expand Down Expand Up @@ -100,7 +101,6 @@ class AppInitComponent extends React.Component {
if (!success) {
this.props.showNotification("missingtheme", LocaleUtils.tr("app.missingpermalink"), NotificationType.WARN, true);
}
this.props.setStartupParameters({...params});
let theme = ThemeUtils.getThemeById(themes, params.t);
if (!theme || theme.restricted) {
if (ConfigUtils.getConfigProp("dontLoadDefaultTheme")) {
Expand All @@ -110,8 +110,11 @@ class AppInitComponent extends React.Component {
this.props.showNotification("missingtheme", LocaleUtils.tr("app.missingtheme", params.t), NotificationType.WARN, true);
params.l = undefined;
}
theme = ThemeUtils.getThemeById(themes, themes.defaultTheme);
const defaultTheme = Object.fromEntries(this.props.userInfos?.default_url_params.split("&").map(x => x.split("="))).t || themes.defaultTheme;
theme = ThemeUtils.getThemeById(themes, defaultTheme);
params.t = defaultTheme;
}
this.props.setStartupParameters({...params});
const layerParams = params.l !== undefined ? params.l.split(",").filter(entry => entry) : null;
if (layerParams && ConfigUtils.getConfigProp("urlReverseLayerOrder")) {
layerParams.reverse();
Expand Down Expand Up @@ -168,6 +171,7 @@ class AppInitComponent extends React.Component {
const AppInit = connect(state => ({
mapSize: state.map.size,
layers: state.layers.flat,
userInfos: state.localConfig.user_infos,
currentTask: state.task.id
}), {
themesLoaded: themesLoaded,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwc2",
"version": "2024.03.06-master",
"version": "2024.03.07-master",
"description": "QGIS Web Client 2 core",
"author": "Sourcepole AG",
"license": "BSD-2-Clause",
Expand Down

0 comments on commit f9c61ba

Please sign in to comment.