🐛 Fix issue when filtering fields type select & multi_select on Notion Node (#1819)

Also, it adds a change to how the links are handled. Before, if a link were left blank, the node would error. Now, if the link is left blank, it gets ignored.
This commit is contained in:
Ricardo Espinoza
2021-05-24 17:45:58 -04:00
committed by GitHub
parent ce9951d877
commit 2a7a87eb4d
2 changed files with 7 additions and 2 deletions

View File

@@ -212,8 +212,11 @@ export class Notion implements INodeType {
async getPropertySelectValues(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const [name, type] = (this.getCurrentNodeParameter('&key') as string).split('|');
const databaseId = this.getCurrentNodeParameter('databaseId') as string;
const resource = this.getCurrentNodeParameter('resource') as string;
const operation = this.getCurrentNodeParameter('operation') as string;
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
return (properties[name][type].options).map((option: IDataObject) => ({ name: option.name, value: option.id }));
const useNames = (resource === 'databasePage' && operation === 'getAll');
return (properties[name][type].options).map((option: IDataObject) => ({ name: option.name, value: (['select', 'multi_select'].includes(type) && useNames) ? option.name : option.id }));
},
async getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];