From 32f245da53c186a03172dbb23761a05b5e301532 Mon Sep 17 00:00:00 2001 From: Jonathan Bennetts Date: Thu, 23 Jun 2022 22:15:29 +0100 Subject: [PATCH] fix(LinkedIn Node): Fix LinkedIn image preview (#3528) * Fixed issue with Preview not being generated when description and title is blank * Nodelinter fixes * Fixed lint issue... build should work Co-authored-by: Jan Oberhauser --- .../nodes-base/nodes/LinkedIn/LinkedIn.node.ts | 16 +++++++++++++--- .../nodes/LinkedIn/PostDescription.ts | 2 +- packages/nodes-base/nodes/LinkedIn/linkedin.png | Bin 543 -> 0 bytes packages/nodes-base/nodes/LinkedIn/linkedin.svg | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 packages/nodes-base/nodes/LinkedIn/linkedin.png create mode 100644 packages/nodes-base/nodes/LinkedIn/linkedin.svg diff --git a/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts b/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts index ce802c4f0d305..2fd68fa3eec7a 100644 --- a/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts +++ b/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts @@ -19,10 +19,10 @@ export class LinkedIn implements INodeType { description: INodeTypeDescription = { displayName: 'LinkedIn', name: 'linkedIn', - // eslint-disable-next-line n8n-nodes-base/node-class-description-icon-not-svg - icon: 'file:linkedin.png', + icon: 'file:linkedin.svg', group: ['input'], version: 1, + subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Consume LinkedIn API', defaults: { name: 'LinkedIn', @@ -76,7 +76,8 @@ export class LinkedIn implements INodeType { let responseData; const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; - let body = {}; + + let body:any = {};// tslint:disable-line:no-any for (let i = 0; i < items.length; i++) { try { @@ -220,6 +221,15 @@ export class LinkedIn implements INodeType { 'com.linkedin.ugc.MemberNetworkVisibility': visibility, }, }; + + if (description === '') { + delete body.specificContent['com.linkedin.ugc.ShareContent'].media[0].description; + } + + if (title === '') { + delete body.specificContent['com.linkedin.ugc.ShareContent'].media[0].title; + } + } else { body = { author: authorUrn, diff --git a/packages/nodes-base/nodes/LinkedIn/PostDescription.ts b/packages/nodes-base/nodes/LinkedIn/PostDescription.ts index 6980afde61e31..9d9d8e9fbe2aa 100644 --- a/packages/nodes-base/nodes/LinkedIn/PostDescription.ts +++ b/packages/nodes-base/nodes/LinkedIn/PostDescription.ts @@ -32,7 +32,7 @@ export const postFields: INodeProperties[] = [ displayName: 'Post As', name: 'postAs', type: 'options', - default: '', + default: 'person', description: 'If to post on behalf of a user or an organization', options: [ { diff --git a/packages/nodes-base/nodes/LinkedIn/linkedin.png b/packages/nodes-base/nodes/LinkedIn/linkedin.png deleted file mode 100644 index be815e9ed97ccd9d48da926dcced020a6f0ca362..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 543 zcmeAS@N?(olHy`uVBq!ia0vp^HXzKw3=&b&bO2Hn0X`wFK$@X^JN=Op_r9q>tJO<_ z{DK+wz1^|9=7*nb?^lI0oGXQ*jIJE*O7eRD;_-tmlPfGWR3zu*xH&u%3t&9Kz`&^Q z>EamTas2I+(|OGX09)AwB+Fr8zyoa zhKhaCQTy^rJ>6i+5vR6qOSay%H20phz4NCfv$%&?k&nhhR@IO4ElU*+?)VpY`l9;c zJpoqhbk^GWcGc|Oq#Jbd`~T#Bk1}t?-kHMJ&fK$oQsc>pdEG%r zb}yW>`0gd{WMj+4JU_m@Oin9tgTe~DWM4f_yX)j diff --git a/packages/nodes-base/nodes/LinkedIn/linkedin.svg b/packages/nodes-base/nodes/LinkedIn/linkedin.svg new file mode 100644 index 0000000000000..1f2df785d3f8d --- /dev/null +++ b/packages/nodes-base/nodes/LinkedIn/linkedin.svg @@ -0,0 +1 @@ + \ No newline at end of file