Skip to content

Commit

Permalink
Merge pull request #1662 from ProcessMaker/bugfix/FOUR-17488
Browse files Browse the repository at this point in the history
FOUR-17488: Back redirection on element destination with external URL is not correct
  • Loading branch information
ryancooley authored Aug 9, 2024
2 parents 4c24e73 + 4a9c4d8 commit 64063ad
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ export default {
const elementDestinationUrl = elementDestination.value;
if (elementDestinationUrl) {
// Save the referring URL to sessionStorage for future verification
sessionStorage.setItem('sessionUrlActionBlocker', document.referrer);
return elementDestinationUrl;
}
Expand Down Expand Up @@ -801,6 +803,30 @@ export default {
requestIdNode.setAttribute('content', this.requestId);
}
},
/**
* Checks for the presence of a URL action blocker in sessionStorage and handles it.
*
* This method retrieves the 'sessionUrlActionBlocker' value from sessionStorage,
* and if present, removes it and emits a 'closed' event with the task id and
* the source of the redirection. It returns false if the blocker was handled,
* and true otherwise.
*
* @returns {boolean} Returns false if the 'sessionUrlActionBlocker' was found and handled, true otherwise.
*/
hasUrlActionBlocker() {
// Retrieve the 'sessionUrlActionBlocker' value from sessionStorage
const redirectedFrom = sessionStorage.getItem("sessionUrlActionBlocker");
if (redirectedFrom) {
// Remove 'sessionUrlActionBlocker' from sessionStorage after retrieving its value
sessionStorage.removeItem("sessionUrlActionBlocker");
// Emit a 'closed' event with the task id and the source of the redirection
this.$emit("closed", this.task?.id, redirectedFrom);
return true;
}
return false;
},
},
mounted() {
Expand All @@ -811,7 +837,9 @@ export default {
this.nodeId = this.initialNodeId;
this.requestData = this.value;
this.loopContext = this.initialLoopContext;
this.loadTask();
if (!this.hasUrlActionBlocker()) {
this.loadTask();
}
},
destroyed() {
this.unsubscribeSocketListeners();
Expand Down

0 comments on commit 64063ad

Please sign in to comment.