-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct paging improvements #2537
Changes from all commits
af013db
25253b7
135b1b4
8e90539
2c8a065
563cf32
7ab6dd6
9ab0e6a
a33cdf5
b5a2b36
01650dd
295fbbb
2c482eb
201b761
0af6ce7
303a511
baa0db5
10b769b
708f466
9a75f17
517373c
dbb2378
c52c340
1014502
be132c2
daa0722
bd06987
9e3aafa
c575605
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ def _trigger_alert( | |
deleted_at=None, | ||
defaults={ | ||
"author": from_user, | ||
"verbal_name": "Direct paging", | ||
"verbal_name": f"Direct paging ({team.name if team else 'No'} team)", | ||
iskhakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
) | ||
if alert_receive_channel.default_channel_filter is None: | ||
|
@@ -90,7 +90,7 @@ def _trigger_alert( | |
return alert.group | ||
|
||
|
||
def check_user_availability(user: User, team: Team) -> list[dict[str, Any]]: | ||
def check_user_availability(user: User) -> list[dict[str, Any]]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made so that user availability doesn't depend on the selected team. My reasoning is the following:
So I'd think it makes sense to check availability across all teams, not only the selected one. |
||
"""Check user availability to be paged. | ||
|
||
Return a warnings list indicating `error` and any additional related `data`. | ||
|
@@ -108,7 +108,6 @@ def check_user_availability(user: User, team: Team) -> list[dict[str, Any]]: | |
schedules = OnCallSchedule.objects.filter( | ||
Q(cached_ical_file_primary__contains=user.username) | Q(cached_ical_file_primary__contains=user.email), | ||
organization=user.organization, | ||
team=team, | ||
) | ||
schedules_data = {} | ||
for s in schedules: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ class DirectPagingSerializer(serializers.Serializer): | |
alert_group = serializers.HiddenField(default=None) # set in DirectPagingSerializer.validate | ||
|
||
title = serializers.CharField(required=False, default=None) | ||
message = serializers.CharField(required=False, default=None) | ||
message = serializers.CharField(required=False, default=None, allow_null=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The frontend treats an empty message as |
||
|
||
team = TeamPrimaryKeyRelatedField(allow_null=True, default=CurrentTeamDefault()) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
class StartCreateIncidentFromSlashCommand(scenario_step.ScenarioStep): | ||
""" | ||
StartCreateIncidentFromSlashCommand triggers creation of a manual incident from the slack message via slash command | ||
THIS FEATURE IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deprecating |
||
""" | ||
|
||
command_name = [settings.SLACK_SLASH_COMMAND_NAME] | ||
|
@@ -232,6 +233,18 @@ def process_scenario(self, slack_user_identity, slack_team_identity, payload): | |
|
||
|
||
def _get_manual_incident_form_view(routing_uid, blocks, private_metatada): | ||
deprecation_blocks = [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": f":no_entry: This command is deprecated and will be removed soon. Please use {settings.SLACK_DIRECT_PAGING_SLASH_COMMAND} command instead :no_entry:", | ||
"emoji": True, | ||
}, | ||
}, | ||
{"type": "divider"}, | ||
] | ||
|
||
view = { | ||
"type": "modal", | ||
"callback_id": routing_uid, | ||
|
@@ -248,7 +261,7 @@ def _get_manual_incident_form_view(routing_uid, blocks, private_metatada): | |
"type": "plain_text", | ||
"text": "Submit", | ||
}, | ||
"blocks": blocks, | ||
"blocks": deprecation_blocks + blocks, | ||
"private_metadata": private_metatada, | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to return team name to integration name, this way it's easier to filter by integration on the alert groups page.
It also makes things more consistent with other platforms where it's not possible to provide a team widget alongside integration name (e.g. Slack).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure it is a good practice to hardcode it lake that. We should use the value from teams table in the places you mentioned