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 <janober@users.noreply.github.com>
This commit is contained in:
Jonathan Bennetts 2022-06-23 22:15:29 +01:00 committed by GitHub
parent 3ee384fd87
commit 32f245da53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View file

@ -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,

View file

@ -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: [
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 67 66" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><use xlink:href="#A" x="1" y="1"/><symbol id="A" overflow="visible"><g stroke="none" fill-rule="nonzero"><path d="M59.26 0H4.724C2.12 0 0 2.066 0 4.61v54.788c0 2.53 2.12 4.6 4.724 4.6h54.54c2.61 0 4.736-2.07 4.736-4.6V4.61C64 2.066 61.874 0 59.26 0z" fill="#0177b5"/><path d="M9.49 23.992H19v30.54H9.49zm4.748-15.2c3.034 0 5.5 2.466 5.5 5.5a5.51 5.51 0 0 1-5.498 5.506 5.52 5.52 0 0 1-5.508-5.506 5.5 5.5 0 0 1 5.506-5.5m10.7 15.2h9.104v4.174h.126c1.268-2.4 4.364-4.932 9-4.932 9.612 0 11.386 6.326 11.386 14.548v16.752h-9.486V39.678c0-3.54-.064-8.1-4.932-8.1-4.94 0-5.7 3.86-5.7 7.84v15.108h-9.484v-30.54z"/></g></symbol></svg>

After

Width:  |  Height:  |  Size: 824 B