mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
feat(Microsoft Teams Node): Overhaul (#7477)
Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeListSearchItems } from 'n8n-workflow';
|
||||
|
||||
export function prepareMessage(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
message: string,
|
||||
contentType: string,
|
||||
includeLinkToWorkflow: boolean,
|
||||
instanceId?: string,
|
||||
) {
|
||||
if (includeLinkToWorkflow) {
|
||||
const { id } = this.getWorkflow();
|
||||
const link = `${this.getInstanceBaseUrl()}workflow/${id}?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=${encodeURIComponent(
|
||||
'n8n-nodes-base.microsoftTeams',
|
||||
)}${instanceId ? '_' + instanceId : ''}`;
|
||||
contentType = 'html';
|
||||
message = `${message}<br><br><em> Powered by <a href="${link}">this n8n workflow</a> </em>`;
|
||||
}
|
||||
|
||||
return {
|
||||
body: {
|
||||
contentType,
|
||||
content: message,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function filterSortSearchListItems(items: INodeListSearchItems[], filter?: string) {
|
||||
return items
|
||||
.filter(
|
||||
(item) =>
|
||||
!filter ||
|
||||
item.name.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
item.value.toString().toLowerCase().includes(filter.toLowerCase()),
|
||||
)
|
||||
.sort((a, b) => {
|
||||
if (a.name.toLocaleLowerCase() < b.name.toLocaleLowerCase()) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name.toLocaleLowerCase() > b.name.toLocaleLowerCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user