Skip to content
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

Notify user when their shift swap request is taken #2992

Merged
merged 13 commits into from
Sep 7, 2023

Conversation

joeyorlando
Copy link
Contributor

@joeyorlando joeyorlando commented Sep 7, 2023

What this PR does

Closes #2868

Slack thread message
Screenshot 2023-09-07 at 15 47 30

Push notification
Clicking on the push notification goes to the SSR detail view

Screenshot 2023-09-07 at 15 48 59

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Sep 7, 2023
@joeyorlando joeyorlando requested a review from a team September 7, 2023 09:44
@@ -59,8 +59,6 @@ def _do_take(self, benefactor: User) -> dict:
new_state=shift_swap.insight_logs_serialized,
)

update_shift_swap_request_message.apply_async((shift_swap.pk,))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to ShiftSwapRequest.take (as this needs to be done in two spots, incoming API requests as well as Slack events when clicking "Accept")

Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

engine/apps/schedules/models/shift_swap_request.py Outdated Show resolved Hide resolved
@joeyorlando joeyorlando added this pull request to the merge queue Sep 7, 2023
Merged via the queue into dev with commit 4b0bb86 Sep 7, 2023
@joeyorlando joeyorlando deleted the jorlando/notify-beneficiary-when-ssr-taken branch September 7, 2023 15:05
Comment on lines +227 to +230
"text": (
f"{shift_swap_request.beneficiary.get_username_with_slack_verbal(True)} your teammate "
f"{shift_swap_request.benefactor.get_username_with_slack_verbal()} has taken the shift swap request"
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe just having <user> has taken the shift swap request could work better here?
I feel like addressing the SSR beneficiary directly would work well in DMs, but the thread message is visible to multiple people, so maybe it'd make sense to rephrase this so it's not directed at a single person?


message: Message = mock_send_push_notification.call_args.args[1]
assert message.data["type"] == "oncall.info"
assert message.data["title"] == "Your shift swap request has been taken"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe add a test to check that no one is getting push notifications except the beneficiary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
3 participants