Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n8n-2914 linkedin image preview #3528

Merged
merged 4 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/LinkedIn/PostDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Binary file removed packages/nodes-base/nodes/LinkedIn/linkedin.png
Binary file not shown.
1 change: 1 addition & 0 deletions packages/nodes-base/nodes/LinkedIn/linkedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.