mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
🐛 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:
@@ -136,7 +136,7 @@ export function formatText(content: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLink(text: { textLink: string, isLink: boolean }) {
|
function getLink(text: { textLink: string, isLink: boolean }) {
|
||||||
if (text.isLink === true) {
|
if (text.isLink === true && text.textLink !== '') {
|
||||||
return {
|
return {
|
||||||
link: {
|
link: {
|
||||||
url: text.textLink,
|
url: text.textLink,
|
||||||
@@ -270,10 +270,12 @@ function getPropertyKeyValue(value: any, type: string, timezone: string) {
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
|
//&& value.dateStart !== 'Invalid date' && value.dateEnd !== 'Invalid date'
|
||||||
if (value.range === true) {
|
if (value.range === true) {
|
||||||
result = {
|
result = {
|
||||||
type: 'date', date: { start: moment.tz(value.dateStart, timezone).utc().format(), end: moment.tz(value.dateEnd, timezone).utc().format() },
|
type: 'date', date: { start: moment.tz(value.dateStart, timezone).utc().format(), end: moment.tz(value.dateEnd, timezone).utc().format() },
|
||||||
};
|
};
|
||||||
|
//if (value.date !== 'Invalid date')
|
||||||
} else {
|
} else {
|
||||||
result = {
|
result = {
|
||||||
type: 'date', date: { start: moment.tz(value.date, timezone).utc().format(), end: null },
|
type: 'date', date: { start: moment.tz(value.date, timezone).utc().format(), end: null },
|
||||||
|
|||||||
@@ -212,8 +212,11 @@ export class Notion implements INodeType {
|
|||||||
async getPropertySelectValues(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getPropertySelectValues(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const [name, type] = (this.getCurrentNodeParameter('&key') as string).split('|');
|
const [name, type] = (this.getCurrentNodeParameter('&key') as string).split('|');
|
||||||
const databaseId = this.getCurrentNodeParameter('databaseId') as string;
|
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}`);
|
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[]> {
|
async getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user