Skip to content

Commit

Permalink
Fixing a bug where the person closing the incident was not displaying (
Browse files Browse the repository at this point in the history
…#439)

* Fixing a bug where the person closing the incident was not displaying properly

* Modifying the logging message to be more descriptive when the channel has been archived
  • Loading branch information
sylviamclaughlin authored Mar 27, 2024
1 parent 394baf0 commit b00e6c3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/modules/incident/incident_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ def close_incident(client, body, ack):
# Update the spreadsheet with the current incident with status = closed
google_drive.update_spreadsheet_close_incident(return_channel_name(channel_name))

# Need to post the message before the channe is archived so that the message can be delivered.
client.chat_postMessage(
channel=channel_id,
text=f"<@{user_id}> has archived this channel 👋",
)

# archive the channel
response = client.conversations_archive(channel=channel_id)

Expand All @@ -353,10 +359,9 @@ def close_incident(client, body, ack):
"Could not archive the channel %s - %s", channel_name, response["error"]
)
else:
# post a message that the channel has been archived by the user
client.chat_postMessage(
channel=channel_id,
text=f"<@{user_id}> has archived this channel 👋",
# Log the message that the user has archived the channel.
logging.info(
"Channel %s has been archived by %s", channel_name, f"<@{user_id}>"
)


Expand Down

0 comments on commit b00e6c3

Please sign in to comment.