diff --git a/lib/oto/commands/util/jira.dart b/lib/oto/commands/util/jira.dart index 1378072..c0cd290 100644 --- a/lib/oto/commands/util/jira.dart +++ b/lib/oto/commands/util/jira.dart @@ -1,5 +1,5 @@ -// ignore_for_file: prefer_function_declarations_over_variables +// ignore_for_file: prefer_function_declarations_over_variables, avoid_init_to_null import 'dart:convert'; @@ -11,6 +11,22 @@ import 'package:http/http.dart' as http; import 'package:oto_cli/oto/data/jira_data.dart'; class Jira extends Command { + String? findContent(DataJiraContent? data) { + if(data != null) { + if(data.text != null) { + return data.text; + } else { + if(data.content != null && data.content!.isNotEmpty) { + return findContent(data.content!.first); + } else { + return null; + } + } + } else { + return null; + } + } + @override Future execute(DataCommand command) async { var data = DataJira.fromJson(command.param); @@ -44,9 +60,10 @@ class Jira extends Command { var arr = issue.fields?.description?.content; var summary = issue.fields?.summary; if((arr != null && arr.isNotEmpty) || summary != null) { - var content = ''; + String? content = ""; if(arr != null && arr.isNotEmpty) { - content = arr!.first.content!.first.text!; + content = findContent(arr.first); + content ??= summary!; } else { content = summary!; } diff --git a/slack_test.yaml b/slack_test.yaml index 5fa4134..abb9306 100644 --- a/slack_test.yaml +++ b/slack_test.yaml @@ -19,13 +19,29 @@ commands: id: leedongmyung@lguplus.co.kr token: ATATT3xFfGF0mklis_51fqVtxqIatXsuUoOsgu6HXdWXh6nTnQOE964iSZnh0QhgUFZejaljlqsZVBA6OlG8hg74lnmyYKPB7M2Et2mAq3TsvvQskT6VwnG4mGXQ1ff-KIhPvfMvGmGzrQ7UeefC5muJusEcmy1nknxZC8CK4OhYQjAc07GnRmg=B6CBDA6F domain: lgu-cto.atlassian.net - issue: M3-21 - sub-channel: build-test + issue: M3-27 + sub-channel: jira-noti users: - mail: leedongmyung@lguplus.co.kr slackID: U05A94D57RS - mail: sunmikk@lguplus.co.kr slackID: U03SNLHMMAB + - mail: rlfrmsdh@lguplus.co.kr + slackID: U042W5NCXK5 + - mail: somyoung@lguplus.co.kr + slackID: U03SNLHBZF1 + - mail: bjkim01@lguplus.co.kr + slackID: U03SWKGJFKQ + - mail: ruin8452@lguplus.co.kr + slackID: U05MZ8GJVS7 + - mail: song0258@lguplus.co.kr + slackID: U047RUK30RY + - mail: wiznine@lguplus.co.kr + slackID: U03T3801W3C + - mail: sheon@lguplus.co.kr + slackID: U03T08SMS93 + - mail: dooyeon@lguplus.co.kr + slackID: U03SNLH637Z return-slack-data: return-slack-channel: - command: Slack