Skip to content

Conversation

@mattrco
Copy link
Contributor

@mattrco mattrco commented Aug 20, 2019

Uses a pre_save signal to determine if the incident has been closed by this operation (otherwise, if an incident is edited after close, this will fire again).


if instance.is_closed():
user_to_notify = instance.lead or instance.reporter
doc_url = urljoin(
Copy link
Contributor Author

@mattrco mattrco Aug 20, 2019

Choose a reason for hiding this comment

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

This could refactored into a model function, but it's only used here and to update the slack topic.

@mattrco mattrco added the wip Work in Progress label Aug 20, 2019
post_save only has access to the updated model (it's been written to the
db, so we can't determine if the incident was just closed.

Use pre_save which allows us to retrieve the current state and compare.
@mattrco mattrco force-pushed the mattrco/nudge-incident-report branch from f406ad9 to 44e3c03 Compare August 20, 2019 14:18
@mattrco mattrco removed the wip Work in Progress label Aug 20, 2019
@mattrco mattrco requested review from a team, evnsio and milesbxf August 20, 2019 14:21
@milesbxf milesbxf merged commit 5ffb15d into master Aug 21, 2019
@milesbxf milesbxf deleted the mattrco/nudge-incident-report branch August 21, 2019 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants