diff --git a/src/dispatch/incident/flows.py b/src/dispatch/incident/flows.py index a3de8af38ffa..307dde1cfc6b 100644 --- a/src/dispatch/incident/flows.py +++ b/src/dispatch/incident/flows.py @@ -1118,7 +1118,7 @@ def incident_update_flow( # add new folks to the incident if appropriate # we only have to do this for teams as new members will be added to tactical # groups on incident join - if incident.status != IncidentStatus.closed: + if incident.status == IncidentStatus.active: individual_participants, team_participants = get_incident_participants(incident, db_session) for individual, service_id in individual_participants: diff --git a/src/dispatch/plugins/dispatch_jira/plugin.py b/src/dispatch/plugins/dispatch_jira/plugin.py index 1161a9977508..29c9c9af588a 100644 --- a/src/dispatch/plugins/dispatch_jira/plugin.py +++ b/src/dispatch/plugins/dispatch_jira/plugin.py @@ -50,10 +50,12 @@ def get_email_username(email: str) -> str: return email -def get_user_field(client: JIRA, user_email) -> dict: +def get_user_field(client: JIRA, user_email: str, project_key: str) -> dict: """Returns correct Jira user field based on Jira hosting type.""" if JIRA_HOSTING_TYPE == "Server": - user = client.search_users(user_email, maxResults=1)[0] + user = client.search_allowed_users_for_issue( + user_email, projectKey=project_key, maxResults=1 + )[0] return {"name": user.name} if JIRA_HOSTING_TYPE == "Cloud": username = get_email_username(user_email) @@ -173,13 +175,14 @@ def create( """Creates a Jira issue.""" client = JIRA(str(JIRA_API_URL), basic_auth=(JIRA_USERNAME, str(JIRA_PASSWORD))) - assignee = get_user_field(client, commander_email) - reporter = get_user_field(client, reporter_email) - project_id, issue_type_name = process_incident_type_plugin_metadata( incident_type_plugin_metadata ) + project = client.project(project_id) + assignee = get_user_field(client, commander_email, project.key) + reporter = get_user_field(client, reporter_email, project.key) + issue_fields = { "project": {"id": project_id}, "issuetype": {"name": issue_type_name}, @@ -210,12 +213,13 @@ def update( """Updates Jira issue fields.""" client = JIRA(str(JIRA_API_URL), basic_auth=(JIRA_USERNAME, str(JIRA_PASSWORD))) - assignee = get_user_field(client, commander_email) - reporter = get_user_field(client, reporter_email) - commander_username = get_email_username(commander_email) issue = client.issue(ticket_id) + + assignee = get_user_field(client, commander_email, project_key=issue.fields.project.key) + reporter = get_user_field(client, reporter_email, project_key=issue.fields.project.key) + issue_fields = create_issue_fields( title=title, description=description, diff --git a/src/dispatch/plugins/dispatch_slack/events.py b/src/dispatch/plugins/dispatch_slack/events.py index f8070048411c..29caaeb6c6d0 100644 --- a/src/dispatch/plugins/dispatch_slack/events.py +++ b/src/dispatch/plugins/dispatch_slack/events.py @@ -309,6 +309,7 @@ def ban_threads_warning( # value, when they differ the latter is a reply to the former. message = "Please refrain from using threads in incident related channels. Threads make it harder for incident participants to maintain context." dispatch_slack_service.send_ephemeral_message( + slack_client, channel_id, user_id, message,