From e9fd5815c93c7b5ac95b4c54f4cc2082d859f593 Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Sun, 28 Apr 2019 20:39:05 +0200 Subject: [PATCH] Display FavApps tab by default if required (#1689) --- .../lib/Lemonldap/NG/Portal/Main/Menu.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm index 57d7c26df..c75679cf0 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm @@ -67,6 +67,10 @@ sub params { (qw/favApps appslist password logout loginHistory oidcConsents/); my @customTabs = split( /,\s*/, $self->{conf}->{customMenuTabs} || '' ); + $res{DISPLAY_MODULES} = $self->displayModules($req); + $res{AUTH_ERROR_TYPE} = + $req->error_type( $res{AUTH_ERROR} = $req->menuError ); + # Tab to display # Get the tab URL parameter @@ -106,14 +110,10 @@ sub params { $res{DISPLAY_TAB} = $req->param("tab"); } else { - $res{DISPLAY_TAB} = "appslist"; + $res{DISPLAY_TAB} = $res{DISPLAY_MODULES}->[0]->{FavApps} ? "favApps" : "appslist"; } } - $res{DISPLAY_MODULES} = $self->displayModules($req); - $res{AUTH_ERROR_TYPE} = - $req->error_type( $res{AUTH_ERROR} = $req->menuError ); - # Display menu 2fRegisters link only if at least a 2F device is registered $res{sfaManager} = $self->p->_sfEngine->display2fRegisters( $req, $req->userData ); @@ -368,11 +368,11 @@ sub _filterHash { } # Check if app is marked as favorite - my $appuri = $apphash->{$key}->{options}->{uri}; + my $uri = $apphash->{$key}->{options}->{uri}; foreach (@$favAppslistRef) { - if ( $_->{appuri} eq $appuri ) { + if ( $_->{appuri} eq $uri ) { $apphash->{$key}->{options}->{isFavApp} = "1"; - $self->logger->debug("App $appuri is marked as favorite"); + $self->logger->debug("App $uri is marked as favorite"); last; } }