mirror of
https://github.com/owncast/owncast.git
synced 2024-11-22 12:49:37 +03:00
fix: external actions were assuming all actions are urls. Fixes #3213
This commit is contained in:
parent
7575c64d14
commit
16db7825c9
1 changed files with 22 additions and 17 deletions
|
@ -138,27 +138,32 @@ export const Content: FC = () => {
|
||||||
|
|
||||||
const externalActionSelected = (action: ExternalAction) => {
|
const externalActionSelected = (action: ExternalAction) => {
|
||||||
const { openExternally, url } = action;
|
const { openExternally, url } = action;
|
||||||
const updatedUrl = new URL(url);
|
|
||||||
updatedUrl.searchParams.append('instance', currentBrowserWindowUrl);
|
|
||||||
|
|
||||||
if (currentUser) {
|
if (url) {
|
||||||
const { displayName } = currentUser;
|
const updatedUrl = new URL(url);
|
||||||
|
updatedUrl.searchParams.append('instance', currentBrowserWindowUrl);
|
||||||
|
|
||||||
// Append url and username to params so the link knows where we came from and who we are.
|
if (currentUser) {
|
||||||
updatedUrl.searchParams.append('username', displayName);
|
const { displayName } = currentUser;
|
||||||
}
|
|
||||||
const fullUrl = updatedUrl.toString();
|
|
||||||
// Overwrite URL with the updated one that includes the params.
|
|
||||||
const updatedAction = {
|
|
||||||
...action,
|
|
||||||
url: fullUrl,
|
|
||||||
};
|
|
||||||
|
|
||||||
// apply openExternally only if we don't have an HTML embed
|
// Append url and username to params so the link knows where we came from and who we are.
|
||||||
if (openExternally) {
|
updatedUrl.searchParams.append('username', displayName);
|
||||||
window.open(fullUrl, '_blank');
|
}
|
||||||
|
const fullUrl = updatedUrl.toString();
|
||||||
|
// Overwrite URL with the updated one that includes the params.
|
||||||
|
const updatedAction = {
|
||||||
|
...action,
|
||||||
|
url: fullUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
// apply openExternally only if we don't have an HTML embed
|
||||||
|
if (openExternally) {
|
||||||
|
window.open(fullUrl, '_blank');
|
||||||
|
} else {
|
||||||
|
setExternalActionToDisplay(updatedAction);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setExternalActionToDisplay(updatedAction);
|
setExternalActionToDisplay(action);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue