From cf1c6a3632e083b5f89527fba22314ef6c984ba5 Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Thu, 30 May 2024 02:10:49 -0400 Subject: [PATCH] Gitea bugs are now considered to be "in progress" if someone is assigned to the bug. --- Scripts/server_gitea_api.gd | 11 ++++++++--- bugbot.gd | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Scripts/server_gitea_api.gd b/Scripts/server_gitea_api.gd index 827b940..70667bc 100644 --- a/Scripts/server_gitea_api.gd +++ b/Scripts/server_gitea_api.gd @@ -14,6 +14,7 @@ const DEFAULT_HARDWARE_LABEL_PREFIX : StringName = &"Hardware/" const DEFAULT_OS_LABEL_PREFIX : StringName = &"OS/" const DEFAULT_COMPONENT_LABEL_PREFIX : StringName = &"Component/" const DEFAULT_PRIORITY_LABEL_PREFIX : StringName = &"Priority/" +const DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS : bool = true const UNRESOLVED_TAG : StringName = &"Status/Unresolved" const IN_PROGRESS_TAG : StringName = &"Status/In Progress" @@ -52,7 +53,8 @@ func __return_list_of_bugs_thread(map_name:String, callback:Callable) -> void: "resolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses", Array()), } for bug_in:Dictionary in response_data: - var bug : BugbotBugData = __create_bug_data_from_server_response(bug_in, map_name, label_dict, true) + var assigned_as_in_progress : bool = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/show_assigned_as_in_progress", DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS) + var bug : BugbotBugData = __create_bug_data_from_server_response(bug_in, map_name, label_dict, true, assigned_as_in_progress) if bug: bug_array.append(bug) @@ -172,7 +174,8 @@ func __send_form_data_thread(data:Dictionary, map_name:String, bug_position:Vect "in_progress_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/in_progress_statuses", Array()), "resolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses", Array()), } - var bug_data : BugbotBugData = __create_bug_data_from_server_response(post_response_data, map_name, label_dict, false) + var assigned_as_in_progress : bool = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/show_assigned_as_in_progress", DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS) + var bug_data : BugbotBugData = __create_bug_data_from_server_response(post_response_data, map_name, label_dict, false, assigned_as_in_progress) callback.call_deferred(bug_data) __bugbot_server_thread.call_deferred("wait_to_finish") @@ -214,7 +217,7 @@ func __validate_server_response(_response:Variant) -> int: return Error.FAILED return Error.OK -func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, label_dict:Dictionary, validate_labels:bool) -> BugbotBugData: +func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, label_dict:Dictionary, validate_labels:bool, assigned_as_in_progress:bool) -> BugbotBugData: var bugbot_marker_string : String = bug_in["body"].split("\n")[-1] if not bugbot_marker_string.begins_with("{") and not bugbot_marker_string.ends_with("}"): return null @@ -241,6 +244,8 @@ func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, bug.is_open = (bug_in["state"] == "open") if not bug.is_open: resolved_tag_found = true + elif assigned_as_in_progress and bug_in["assignees"] is Array: + in_progress_tag_found = true else: for labels:Dictionary in bug_in["labels"]: bug_labels.append(labels["name"] as String) diff --git a/bugbot.gd b/bugbot.gd index 26e43c7..43fa66c 100644 --- a/bugbot.gd +++ b/bugbot.gd @@ -65,6 +65,7 @@ func __initialise_project_settings() -> void: __add_project_setting("bugbot/reporting/gitea/status_labels/os_label_prefix", TYPE_STRING, BugbotServerGiteaAPI.DEFAULT_OS_LABEL_PREFIX) __add_project_setting("bugbot/reporting/gitea/status_labels/component_label_prefix", TYPE_STRING, BugbotServerGiteaAPI.DEFAULT_COMPONENT_LABEL_PREFIX) __add_project_setting("bugbot/reporting/gitea/status_labels/priority_label_prefix", TYPE_STRING, BugbotServerGiteaAPI.DEFAULT_PRIORITY_LABEL_PREFIX) + __add_project_setting("bugbot/reporting/gitea/status_labels/show_assigned_as_in_progress", TYPE_BOOL, BugbotServerGiteaAPI.DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS) #endregion #region Jira __add_project_setting("bugbot/reporting/jira/server", TYPE_STRING, "https://jira.example.com")