From 9d703e366b8e191e0f588469892ebb7b6d03c1d3 Mon Sep 17 00:00:00 2001 From: Tom <19203795+that-one-tom@users.noreply.github.com> Date: Fri, 1 Apr 2022 08:32:41 +0200 Subject: [PATCH] fix(Google Tasks Node): Fix "Show Completed" option and hide title field where not needed (#2741) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Google Tasks: Fix showCompleted * :zap: Improvements Co-authored-by: ricardo --- .../nodes/Google/Task/GoogleTasks.node.ts | 16 ++++++---------- .../nodes/Google/Task/TaskDescription.ts | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts b/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts index b7aff3e732..98f256f224 100644 --- a/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts +++ b/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts @@ -171,7 +171,7 @@ export class GoogleTasks implements INodeType { //https://developers.google.com/tasks/v1/reference/tasks/list const returnAll = this.getNodeParameter('returnAll', i) as boolean; const taskListId = this.getNodeParameter('task', i) as string; - const options = this.getNodeParameter( + const { showCompleted = true, showDeleted = false, showHidden = false, ...options } = this.getNodeParameter( 'additionalFields', i, ) as IDataObject; @@ -187,15 +187,11 @@ export class GoogleTasks implements INodeType { if (options.dueMax) { qs.dueMax = options.dueMax as string; } - if (options.showCompleted) { - qs.showCompleted = options.showCompleted as boolean; - } - if (options.showDeleted) { - qs.showDeleted = options.showDeleted as boolean; - } - if (options.showHidden) { - qs.showHidden = options.showHidden as boolean; - } + + qs.showCompleted = showCompleted; + qs.showDeleted = showDeleted; + qs.showHidden = showHidden; + if (options.updatedMin) { qs.updatedMin = options.updatedMin as string; } diff --git a/packages/nodes-base/nodes/Google/Task/TaskDescription.ts b/packages/nodes-base/nodes/Google/Task/TaskDescription.ts index c757365df7..87fd42e828 100644 --- a/packages/nodes-base/nodes/Google/Task/TaskDescription.ts +++ b/packages/nodes-base/nodes/Google/Task/TaskDescription.ts @@ -76,6 +76,16 @@ export const taskFields: INodeProperties[] = [ type: 'string', default: '', description: 'Title of the task.', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'task', + ], + }, + }, }, { displayName: 'Additional Fields', @@ -350,21 +360,21 @@ export const taskFields: INodeProperties[] = [ name: 'showCompleted', type: 'boolean', default: true, - description: 'Flag indicating whether completed tasks are returned in the result', + description: 'Flag indicating whether completed tasks are returned in the result. Show Hidden must also be True to show tasks completed in first party clients such as the web UI or Google\'s mobile apps.', }, { displayName: 'Show Deleted', name: 'showDeleted', type: 'boolean', default: false, - description: 'Flag indicating whether deleted tasks are returned in the result', + description: 'Flag indicating whether deleted tasks are returned in the result.', }, { displayName: 'Show Hidden', name: 'showHidden', type: 'boolean', default: false, - description: 'Flag indicating whether hidden tasks are returned in the result', + description: 'Flag indicating whether hidden tasks are returned in the result.', }, { displayName: 'Updated Min',