Skip to content

Commit

Permalink
Fix /escalate predefined org (#4723)
Browse files Browse the repository at this point in the history
Related to grafana/oncall-gateway#276

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
  • Loading branch information
vadimkerr and Konstantinov-Innokentii authored Jul 24, 2024
1 parent 9da5b94 commit b27a158
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions engine/apps/slack/scenarios/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,20 @@ def process_scenario(
if not user_is_oncall(selected_user):
# display additional confirmation modal
metadata = json.loads(payload["view"]["private_metadata"])
private_metadata = make_private_metadata(
{
"state": payload["view"]["state"],
"input_id_prefix": metadata["input_id_prefix"],
"channel_id": metadata["channel_id"],
"submit_routing_uid": metadata["submit_routing_uid"],
DataKey.USERS: metadata[DataKey.USERS],
},
selected_user.organization,
)
private_metadata = {
"state": payload["view"]["state"],
"input_id_prefix": metadata["input_id_prefix"],
"channel_id": metadata["channel_id"],
"submit_routing_uid": metadata["submit_routing_uid"],
DataKey.USERS: metadata[DataKey.USERS],
}
# keep predefined organization in private metadata
if "organization_id" in metadata:
private_metadata["organization_id"] = metadata["organization_id"]

view = _display_confirm_participant_invitation_view(
OnPagingConfirmUserChange.routing_uid(), private_metadata
OnPagingConfirmUserChange.routing_uid(),
make_private_metadata(private_metadata, selected_user.organization),
)
self._slack_client.views_push(trigger_id=payload["trigger_id"], view=view)
else:
Expand Down Expand Up @@ -392,6 +393,10 @@ def process_scenario(
"submit_routing_uid": metadata["submit_routing_uid"],
DataKey.USERS: metadata[DataKey.USERS],
}
# keep predefined organization in private metadata
if "organization_id" in metadata:
private_metadata["organization_id"] = metadata["organization_id"]

previous_view_payload = {
"view": {
"state": metadata["state"],
Expand Down

0 comments on commit b27a158

Please sign in to comment.