1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

feat(Discourse Node): Add new options to Get Users (#7674)

This commit is contained in:
Jon 2023-11-15 10:07:09 +00:00 committed by GitHub
parent b1f678856b
commit 2e8c841277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 111 additions and 0 deletions

View File

@ -372,6 +372,24 @@ export class Discourse implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i);
const flag = this.getNodeParameter('flag', i) as boolean;
const options = this.getNodeParameter('options', i);
if (options.stats) {
qs.stats = options.stats as boolean;
}
if (options.asc) {
qs.asc = options.asc as boolean;
}
if (options.showEmails) {
qs.show_emails = options.showEmails as boolean;
}
if (options.order) {
qs.order = options.order as string;
}
responseData = await discourseApiRequest.call(
this,
'GET',

View File

@ -215,6 +215,10 @@ export const userFields: INodeProperties[] = [
name: 'Suspect',
value: 'suspect',
},
{
name: 'Suspended',
value: 'suspended',
},
],
displayOptions: {
show: {
@ -256,4 +260,93 @@ export const userFields: INodeProperties[] = [
default: 50,
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['user'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Ascending',
name: 'asc',
type: 'boolean',
default: true,
description: 'Whether to sort ascending',
},
{
displayName: 'Order',
name: 'order',
type: 'options',
options: [
{
name: 'Created',
value: 'created',
},
{
name: 'Days Visited',
value: 'days_visited',
},
{
name: 'Email',
value: 'email',
},
{
name: 'Last Emailed',
value: 'last_emailed',
},
{
name: 'Posts',
value: 'posts',
},
{
name: 'Posts Read',
value: 'posts_read',
},
{
name: 'Read Time',
value: 'read_time',
},
{
name: 'Seen',
value: 'seen',
},
{
name: 'Topics Viewed',
value: 'topics_viewed',
},
{
name: 'Trust Level',
value: 'trust_level',
},
{
name: 'Username',
value: 'username',
},
],
default: 'created',
description: 'What to order by',
},
{
displayName: 'Show Emails',
name: 'showEmails',
type: 'boolean',
default: false,
description: 'Whether to include user email addresses',
},
{
displayName: 'Stats',
name: 'stats',
type: 'boolean',
default: false,
description: 'Whether to return user stats',
},
],
},
];