I have a lightning component thats used in LEX, Classic, and a community. The component redirects the user to a record detail page after an action occurs. I am trying to implement UserInfo.getUiThemeDisplayed()
to redirect the user to the correct place depending on the UI theme they are on.
However, in the lightning community it's returning theme3 as the value, I am expecting PortalDefault or Theme4d in the correct themes list
Component:
var locationAction = component.get('c.getLocationTheme');
locationAction.setCallback(this, function(response) {
console.log('Location: ' + response.getReturnValue());
});
$A.enqueueAction(locationAction);
Apex:
@AuraEnabled
public static String getLocationTheme() {
return UserInfo.getUIThemeDisplayed();
}
Debug:
Location: Theme3
Is this expected behavior? What is the correct way of knowing where your lightning component instance is?