jira contents read error 예외 처리

This commit is contained in:
leedongmyung 2024-01-03 15:33:39 +09:00
parent f7f7dc16e9
commit 963e96be85
2 changed files with 38 additions and 5 deletions

View file

@ -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!;
}

View file

@ -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: <!property.slackUser>
return-slack-channel: <!property.slackChannel>
- command: Slack