@@ -78,6 +78,7 @@ export class Slack {
7878 diff : DiffOutputItem
7979 ) : Promise < SendEndpointReturnType > {
8080 const endpoint = `${ diff . method . toUpperCase ( ) } : ${ diff . path } `
81+ const description = diff . description
8182
8283 const changedParameters = this . _getUnchangedItems ( diff . queryParams )
8384 const changedRequestBody = this . _getUnchangedItems ( diff . requestBody )
@@ -150,6 +151,10 @@ export class Slack {
150151 type : 'mrkdwn' ,
151152 text : `*${ translate ( 'endpoint.singular' ) } :*\n ${ endpoint } `
152153 } ,
154+ {
155+ type : 'mrkdwn' ,
156+ text : `*${ translate ( 'description' ) } :*\n ${ description } `
157+ } ,
153158 {
154159 type : 'mrkdwn' ,
155160 text : `*${ translate ( 'repository' ) } : *\n<https://github.com/${
@@ -309,24 +314,94 @@ export class Slack {
309314 } )
310315 }
311316
317+ const changeLogElementList : RichTextList [ ] = [ ]
318+
312319 if ( param . changeLogs . length > 0 ) {
313- const changeLogElementList : RichTextElement [ ] = [ ]
320+ changeLogElementList . push ( {
321+ type : 'rich_text_list' ,
322+ style : 'bullet' ,
323+ indent : 0 ,
324+ border : 1 ,
325+ elements : [
326+ {
327+ type : 'rich_text_section' ,
328+ elements : [
329+ {
330+ type : 'text' ,
331+ text : translate ( 'properties.changed' )
332+ }
333+ ]
334+ }
335+ ]
336+ } )
314337
315338 for ( const changeLog of param . changeLogs ) {
316339 const { field, oldValue, newValue } = changeLog
317340
318341 changeLogElementList . push ( {
319- type : 'text' ,
320- text : `${ field } ${ translate (
321- 'status.modified'
322- ) } : ${ oldValue } -> ${ newValue } `
342+ type : 'rich_text_list' ,
343+ style : 'bullet' ,
344+ indent : 1 ,
345+ border : 1 ,
346+ elements : [
347+ {
348+ type : 'rich_text_section' ,
349+ elements : [
350+ {
351+ type : 'text' ,
352+ text : field
353+ }
354+ ]
355+ }
356+ ]
323357 } )
324- }
325358
326- descriptionElements . push ( {
327- type : 'rich_text_section' ,
328- elements : changeLogElementList
329- } )
359+ let oldValueText = oldValue
360+ let newValueText = newValue
361+
362+ if ( Array . isArray ( oldValue ) ) {
363+ if ( oldValue . length > 0 ) {
364+ oldValueText = oldValue . join ( ', ' )
365+ } else {
366+ oldValueText = `(${ translate ( 'empty.array' ) } )`
367+ }
368+ }
369+
370+ if ( Array . isArray ( newValue ) ) {
371+ if ( newValue . length > 0 ) {
372+ newValueText = newValue . join ( ', ' )
373+ } else {
374+ newValueText = `(${ translate ( 'empty.array' ) } )`
375+ }
376+ }
377+
378+ changeLogElementList . push ( {
379+ type : 'rich_text_list' ,
380+ style : 'bullet' ,
381+ indent : 2 ,
382+ border : 1 ,
383+ elements : [
384+ {
385+ type : 'rich_text_section' ,
386+ elements : [
387+ {
388+ type : 'text' ,
389+ text : `${ translate ( 'changed.before' ) } : \n${ oldValueText } `
390+ }
391+ ]
392+ } ,
393+ {
394+ type : 'rich_text_section' ,
395+ elements : [
396+ {
397+ type : 'text' ,
398+ text : `${ translate ( 'changed.after' ) } : \n${ newValueText } `
399+ }
400+ ]
401+ }
402+ ]
403+ } )
404+ }
330405 }
331406
332407 const description : RichTextList = {
@@ -349,6 +424,11 @@ export class Slack {
349424
350425 elements . push ( statusAndEndpoint )
351426 elements . push ( description )
427+
428+ if ( changeLogElementList . length > 0 ) {
429+ elements . push ( ...changeLogElementList )
430+ }
431+
352432 elements . push ( newline )
353433 }
354434
0 commit comments