Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUR-17272 tasks in a process without interstitial automatically skip to the next task #1654

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export default {
*/
// eslint-disable-next-line consistent-return
async getDestinationUrl() {
const { elementDestination } = this.task || {};
const { elementDestination, allow_interstitial: allowInterstitial } = this.task || {};

if (!elementDestination) {
return null;
Expand All @@ -437,7 +437,7 @@ export default {
const response = await this.retryApiCall(() => this.getTasks(params));

const firstTask = response.data.data[0];
if (firstTask?.user_id === this.userId) {
if (allowInterstitial && firstTask?.user_id === this.userId) {
return `/tasks/${firstTask.id}/edit`;
}

Expand Down Expand Up @@ -487,6 +487,8 @@ export default {
this.nodeId = task.element_id;
} else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
this.$emit('completed', this.getAllowedRequestId());
} else if (!this.taskPreview) {
this.emitClosedEvent();
}
});
},
Expand Down Expand Up @@ -602,20 +604,14 @@ export default {
const queryParams = {
user_id: this.userId,
process_request_id: params.processRequestId,
page: params.page,
per_page: params.perPage,
status: params.status
page: params.page || 1,
per_page: params.perPage || 1,
status: params.status,
};

const queryString = Object.entries(queryParams)
.filter(([, value]) => value !== undefined && value !== null)
.map(
([key, value]) =>
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
)
.join("&");
const queryString = new URLSearchParams(queryParams).toString();

return window.ProcessMaker.apiClient.get(`tasks?${queryString}`);
return this.$dataProvider.getTasks(`?${queryString}`);
},
/**
* Parses a JSON string and returns the result.
Expand Down Expand Up @@ -690,9 +686,13 @@ export default {
data.event === "ACTIVITY_ACTIVATED"
&& data.elementType === 'task'
) {
this.taskId = data.tokenId;
if (!this.task.elementDestination?.type) {
this.taskId = data.taskId;
}

this.reload();
}

if (data.event === 'ACTIVITY_EXCEPTION') {
this.$emit('error', this.requestId);
}
Expand Down
Loading