Skip to content

Commit 756012b

Browse files
pemonttoJoffcom
andauthored
feat(Jira Software Node): Add Wiki Markup support for Jira Cloud comments (#8857)
Co-authored-by: Jonathan Bennetts <[email protected]>
1 parent 00dfad3 commit 756012b

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

packages/nodes-base/nodes/Jira/IssueCommentDescription.ts

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const issueCommentFields: INodeProperties[] = [
111111
displayName: 'Options',
112112
name: 'options',
113113
type: 'collection',
114-
placeholder: 'Add Field',
114+
placeholder: 'Add Option',
115115
default: {},
116116
displayOptions: {
117117
show: {
@@ -130,10 +130,23 @@ export const issueCommentFields: INodeProperties[] = [
130130
value: 'renderedBody',
131131
},
132132
],
133-
default: '',
133+
default: [],
134134
description:
135135
'Use expand to include additional information about comments in the response. This parameter accepts Rendered Body, which returns the comment body rendered in HTML.',
136136
},
137+
{
138+
displayName: 'Use Wiki Markup',
139+
name: 'wikiMarkup',
140+
type: 'boolean',
141+
default: false,
142+
displayOptions: {
143+
show: {
144+
'/jiraVersion': ['cloud'],
145+
},
146+
},
147+
description:
148+
'Whether to enable parsing of wikiformatting for this comment. Default is false.',
149+
},
137150
],
138151
},
139152

@@ -269,7 +282,7 @@ export const issueCommentFields: INodeProperties[] = [
269282
value: 'renderedBody',
270283
},
271284
],
272-
default: '',
285+
default: 'renderedBody',
273286
description:
274287
'Use expand to include additional information about comments in the response. This parameter accepts Rendered Body, which returns the comment body rendered in HTML.',
275288
},
@@ -384,7 +397,7 @@ export const issueCommentFields: INodeProperties[] = [
384397
displayName: 'Options',
385398
name: 'options',
386399
type: 'collection',
387-
placeholder: 'Add Field',
400+
placeholder: 'Add Option',
388401
default: {},
389402
displayOptions: {
390403
show: {
@@ -403,10 +416,23 @@ export const issueCommentFields: INodeProperties[] = [
403416
value: 'renderedBody',
404417
},
405418
],
406-
default: '',
419+
default: 'renderedBody',
407420
description:
408421
'Use expand to include additional information about comments in the response. This parameter accepts Rendered Body, which returns the comment body rendered in HTML.',
409422
},
423+
{
424+
displayName: 'Use Wiki Markup',
425+
name: 'wikiMarkup',
426+
type: 'boolean',
427+
default: false,
428+
displayOptions: {
429+
show: {
430+
'/jiraVersion': ['cloud'],
431+
},
432+
},
433+
description:
434+
'Whether to enable parsing of wikiformatting for this comment. Default is false.',
435+
},
410436
],
411437
},
412438
];

packages/nodes-base/nodes/Jira/Jira.node.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,19 @@ export class Jira implements INodeType {
11671167
}
11681168

11691169
if (resource === 'issueComment') {
1170-
const apiVersion = jiraVersion === 'server' ? '2' : ('3' as string);
1170+
let apiVersion = jiraVersion === 'server' ? '2' : ('3' as string);
11711171

11721172
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
11731173
if (operation === 'add') {
11741174
for (let i = 0; i < length; i++) {
11751175
const jsonParameters = this.getNodeParameter('jsonParameters', 0);
11761176
const issueKey = this.getNodeParameter('issueKey', i) as string;
11771177
const options = this.getNodeParameter('options', i);
1178+
1179+
if (options.wikiMarkup) {
1180+
apiVersion = '2';
1181+
}
1182+
11781183
const body: IDataObject = {};
11791184
if (options.expand) {
11801185
qs.expand = options.expand as string;
@@ -1184,7 +1189,7 @@ export class Jira implements INodeType {
11841189
Object.assign(body, options);
11851190
if (!jsonParameters) {
11861191
const comment = this.getNodeParameter('comment', i) as string;
1187-
if (jiraVersion === 'server') {
1192+
if (jiraVersion === 'server' || options.wikiMarkup) {
11881193
Object.assign(body, { body: comment });
11891194
} else {
11901195
Object.assign(body, {
@@ -1327,10 +1332,15 @@ export class Jira implements INodeType {
13271332
qs.expand = options.expand as string;
13281333
delete options.expand;
13291334
}
1335+
1336+
if (options.wikiMarkup) {
1337+
apiVersion = '2';
1338+
}
1339+
13301340
Object.assign(qs, options);
13311341
if (!jsonParameters) {
13321342
const comment = this.getNodeParameter('comment', i) as string;
1333-
if (jiraVersion === 'server') {
1343+
if (jiraVersion === 'server' || options.wikiMarkup) {
13341344
Object.assign(body, { body: comment });
13351345
} else {
13361346
Object.assign(body, {

0 commit comments

Comments
 (0)