This commit makes certain notifications cancellable. This enables notifications to be sent conditionally based on the user's choice.
This commit is too large to list all changes.