def get_context( notification: BaseNotification, recipient: Union[User, Team], shared_context: Mapping[str, Any], extra_context: Mapping[str, Any], ) -> Mapping[str, Any]: """ Compose the various levels of context and add slack-specific fields. """ return { **shared_context, **notification.get_user_context(recipient, extra_context), }
def get_context( notification: BaseNotification, user: User, shared_context: Mapping[str, Any], extra_context: Mapping[str, Any], ) -> Mapping[str, Any]: """ Compose the various levels of context and add email-specific fields. The generic HTML/text templates only render the unsubscribe link if one is present in the context, so don't automatically add it to every message. """ context = { **shared_context, **notification.get_user_context(user, extra_context), } if can_users_unsubscribe(notification) and notification.group: context.update({ "unsubscribe_link": get_unsubscribe_link(user.id, notification.group.id) }) return context