mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Minor improvements to Matrix Node
This commit is contained in:
@@ -126,16 +126,16 @@ export async function handleMatrixCall(this: IExecuteFunctions | IExecuteSingleF
|
||||
} else if (resource === 'message') {
|
||||
if (operation === 'create') {
|
||||
const roomId = this.getNodeParameter('roomId', index) as string;
|
||||
const text = this.getNodeParameter('text', index) as string;
|
||||
const msgType = this.getNodeParameter('msgType', index) as string;
|
||||
const format = this.getNodeParameter('format', index) as string;
|
||||
const text = this.getNodeParameter('text', index, '') as string;
|
||||
const messageType = this.getNodeParameter('messageType', index) as string;
|
||||
const messageFormat = this.getNodeParameter('messageFormat', index) as string;
|
||||
const body: IDataObject = {
|
||||
msgtype: msgType,
|
||||
msgtype: messageType,
|
||||
body: text,
|
||||
};
|
||||
if (format === 'org.matrix.custom.html') {
|
||||
const fallbackText = this.getNodeParameter('fallbackText', index) as string;
|
||||
body.format = format;
|
||||
if (messageFormat === 'org.matrix.custom.html') {
|
||||
const fallbackText = this.getNodeParameter('fallbackText', index, '') as string;
|
||||
body.format = messageFormat;
|
||||
body.formatted_body = text;
|
||||
body.body = fallbackText;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ export async function handleMatrixCall(this: IExecuteFunctions | IExecuteSingleF
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', index) as number;
|
||||
const qs: IDataObject = {
|
||||
dir: 'b', // Get latest messages first - doesn't return anything if we use f without a previous token.
|
||||
dir: 'b', // GetfallbackText latest messages first - doesn't return anything if we use f without a previous token.
|
||||
limit,
|
||||
};
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ export const messageFields = [
|
||||
description: 'The text to send.',
|
||||
},
|
||||
{
|
||||
displayName: 'Message type',
|
||||
name: 'msgType',
|
||||
displayName: 'Message Type',
|
||||
name: 'messageType',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
@@ -94,11 +94,6 @@ export const messageFields = [
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'm.text',
|
||||
description: 'Send a text message.',
|
||||
},
|
||||
{
|
||||
name: 'Emote',
|
||||
value: 'm.emote',
|
||||
@@ -109,13 +104,18 @@ export const messageFields = [
|
||||
value: 'm.notice',
|
||||
description: 'Send a notice.',
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'm.text',
|
||||
description: 'Send a text message.',
|
||||
},
|
||||
],
|
||||
default: 'm.text',
|
||||
description: 'The type of message to send.',
|
||||
},
|
||||
{
|
||||
displayName: 'Message Format',
|
||||
name: 'format',
|
||||
name: 'messageFormat',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
@@ -140,7 +140,7 @@ export const messageFields = [
|
||||
},
|
||||
],
|
||||
default: 'plain',
|
||||
description: "The format of the message's body.",
|
||||
description: `The format of the message's body.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Fallback Text',
|
||||
@@ -153,7 +153,7 @@ export const messageFields = [
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
format: [
|
||||
messageFormat: [
|
||||
'org.matrix.custom.html',
|
||||
],
|
||||
},
|
||||
@@ -162,7 +162,6 @@ export const messageFields = [
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
placeholder: 'HTML message could not be displayed.',
|
||||
description: 'A plain text message to display in case the HTML cannot be rendered by the Matrix client.',
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user