fix(ui): fix for exception when chat is disabled. Closes #3138

This commit is contained in:
Gabe Kangas 2023-07-05 14:02:39 -07:00
parent d08b518684
commit dc2c46e2a4
No known key found for this signature in database
GPG Key ID: 4345B2060657F330

View File

@ -132,12 +132,15 @@ export const Content: FC = () => {
const externalActionSelected = (action: ExternalAction) => {
const { openExternally, url } = action;
const { displayName } = currentUser;
const updatedUrl = new URL(url);
// Append url and username to params so the link knows where we came from and who we are.
updatedUrl.searchParams.append('username', displayName);
updatedUrl.searchParams.append('instance', currentBrowserWindowUrl);
if (currentUser) {
const { displayName } = currentUser;
// Append url and username to params so the link knows where we came from and who we are.
updatedUrl.searchParams.append('username', displayName);
}
const fullUrl = updatedUrl.toString();
// Overwrite URL with the updated one that includes the params.
const updatedAction = {
@ -146,7 +149,7 @@ export const Content: FC = () => {
};
// apply openExternally only if we don't have an HTML embed
if (openExternally && updatedAction) {
if (openExternally) {
window.open(fullUrl, '_blank');
} else {
setExternalActionToDisplay(updatedAction);