From 28c1a1575fee08cf219de97444ee9d4f5591c6fd Mon Sep 17 00:00:00 2001 From: pmoskrojas <69815070+pmoskrojas@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:38:47 -0400 Subject: [PATCH 1/3] FOUR-10881: Screen interstitial now is displayed when a request is created --- .../processes/modeler/components/inspector/Interstitial.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/js/processes/modeler/components/inspector/Interstitial.vue b/resources/js/processes/modeler/components/inspector/Interstitial.vue index 2e4b98d44b..d7b0d61988 100644 --- a/resources/js/processes/modeler/components/inspector/Interstitial.vue +++ b/resources/js/processes/modeler/components/inspector/Interstitial.vue @@ -61,6 +61,12 @@ export default { this.$set(this.node, "interstitialScreenRef", value); }, }, + allowInterstitialGetter: { + handler(value) { + this.allowInterstitialSetter(value); + }, + immediate: true, + }, }, methods: { /** From 36048cc817af3f6383686c24d02981a82c2829b5 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Fri, 29 Sep 2023 13:14:45 -0700 Subject: [PATCH 2/3] Handle start event redirect using a cookie --- ProcessMaker/Http/Controllers/ProcessController.php | 2 +- ProcessMaker/Http/Controllers/RequestController.php | 4 ++-- ProcessMaker/Http/Middleware/EncryptCookies.php | 1 + resources/js/components/requests/card.vue | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ProcessMaker/Http/Controllers/ProcessController.php b/ProcessMaker/Http/Controllers/ProcessController.php index 6e04c7cf78..a17238bfe3 100644 --- a/ProcessMaker/Http/Controllers/ProcessController.php +++ b/ProcessMaker/Http/Controllers/ProcessController.php @@ -249,7 +249,7 @@ public function triggerStartEventApi(Process $process, Request $request) $apiRequest = new ApiProcessController(); $response = $apiRequest->triggerStartEvent($process, $request); - return redirect('/requests/' . $response->id . '?fromRedirect=true'); + return redirect('/requests/' . $response->id)->cookie('fromTriggerStartEvent', true, 1); } private function checkAuth() diff --git a/ProcessMaker/Http/Controllers/RequestController.php b/ProcessMaker/Http/Controllers/RequestController.php index 19149b21be..1e59cb3380 100644 --- a/ProcessMaker/Http/Controllers/RequestController.php +++ b/ProcessMaker/Http/Controllers/RequestController.php @@ -78,14 +78,14 @@ public function show(ProcessRequest $request, Media $mediaItems) if (isset($definition['allowInterstitial'])) { $allowInterstitial = filter_var($definition['allowInterstitial'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); } - if ($allowInterstitial && $request->user_id == Auth::id() && request()->has('fromRedirect')) { + if ($allowInterstitial && $request->user_id == Auth::id() && request()->cookie('fromTriggerStartEvent')) { $active = $request->tokens() ->where('user_id', Auth::id()) ->where('element_type', 'task') ->where('status', 'ACTIVE') ->orderBy('id')->first(); - return redirect(route('tasks.edit', ['task' => $active ? $active->getKey() : $startEvent->getKey()])); + return redirect(route('tasks.edit', ['task' => $active ? $active->getKey() : $startEvent->getKey()]))->withoutCookie('fromTriggerStartEvent'); } } } diff --git a/ProcessMaker/Http/Middleware/EncryptCookies.php b/ProcessMaker/Http/Middleware/EncryptCookies.php index 3f4c72442e..a0fbbeac86 100644 --- a/ProcessMaker/Http/Middleware/EncryptCookies.php +++ b/ProcessMaker/Http/Middleware/EncryptCookies.php @@ -20,5 +20,6 @@ class EncryptCookies extends BaseEncrypter * Add any cookie names where we should not encrypt it's data here */ 'device_id', + 'fromTriggerStartEvent', ]; } diff --git a/resources/js/components/requests/card.vue b/resources/js/components/requests/card.vue index 7db15401d7..0e122a8401 100644 --- a/resources/js/components/requests/card.vue +++ b/resources/js/components/requests/card.vue @@ -59,10 +59,11 @@ export default { .then(response => { this.spin = 0; var instance = response.data; + this.$cookies.set('fromTriggerStartEvent', true, '1min'); if (this.$cookies.get("isMobile")) { - window.location = "/requests/mobile/" + instance.id + '?fromRedirect=true'; + window.location = "/requests/mobile/" + instance.id; } else { - window.location = "/requests/" + instance.id + '?fromRedirect=true'; + window.location = "/requests/" + instance.id; } }).catch((err) => { this.disabled = false; From 818f97b4065436b21b9ee50db80ba7cb89b9d53f Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Fri, 29 Sep 2023 13:46:31 -0700 Subject: [PATCH 3/3] Update Interstitial.vue --- .../components/inspector/Interstitial.vue | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/resources/js/processes/modeler/components/inspector/Interstitial.vue b/resources/js/processes/modeler/components/inspector/Interstitial.vue index d7b0d61988..c5102a4936 100644 --- a/resources/js/processes/modeler/components/inspector/Interstitial.vue +++ b/resources/js/processes/modeler/components/inspector/Interstitial.vue @@ -26,7 +26,20 @@ import ScreenSelect from "./ScreenSelect"; export default { components: { ScreenSelect }, - props: ["value", "label", "helper", "enabledByDefault"], + props: { + label: { + type: String, + default: '', + }, + helper: { + type: String, + default: '', + }, + enabledByDefault: { + type: Boolean, + default: false + }, + }, data() { return { screen: null, @@ -45,7 +58,7 @@ export default { const { node } = this; // Get the value of allowInterstitial or set it to true if it hasn't been defined yet. - const value = _.get(node, "allowInterstitial", this.enabledByDefault || false); + const value = _.get(node, "allowInterstitial", this.enabledByDefault); this.screen = _.get(node, "interstitialScreenRef"); return value; @@ -61,12 +74,6 @@ export default { this.$set(this.node, "interstitialScreenRef", value); }, }, - allowInterstitialGetter: { - handler(value) { - this.allowInterstitialSetter(value); - }, - immediate: true, - }, }, methods: { /** @@ -76,5 +83,10 @@ export default { this.$set(this.node, "allowInterstitial", value); }, }, + mounted() { + if (!("allowInterstitial" in this.node)) { + this.$set(this.node, "allowInterstitial", this.enabledByDefault); + } + } };