commit
93cb36c300
6 changed files with 67 additions and 7 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Change Log
|
||||
|
||||
## v1.0.49 (2022-11-01)
|
||||
|
||||
- Enable SMTP email backend by default
|
||||
- Fix Grafana sidebar frontend bug
|
||||
|
||||
## v1.0.48 (2022-11-01)
|
||||
|
||||
- verify_number management command
|
||||
|
|
|
|||
|
|
@ -39,6 +39,20 @@ def notify_user_async(user_pk, alert_group_pk, notification_policy_pk):
|
|||
logger.warning(f"User notification policy {notification_policy_pk} does not exist")
|
||||
return
|
||||
|
||||
# create an error log in case EMAIL_HOST is not specified
|
||||
if not live_settings.EMAIL_HOST:
|
||||
UserNotificationPolicyLogRecord.objects.create(
|
||||
author=user,
|
||||
type=UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_FAILED,
|
||||
notification_policy=notification_policy,
|
||||
alert_group=alert_group,
|
||||
reason="Error while sending email",
|
||||
notification_step=notification_policy.step,
|
||||
notification_channel=notification_policy.notify_by,
|
||||
)
|
||||
logger.error(f"Error while sending email: empty EMAIL_HOST env variable")
|
||||
return
|
||||
|
||||
emails_left = user.organization.emails_left(user)
|
||||
if emails_left <= 0:
|
||||
UserNotificationPolicyLogRecord.objects.create(
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ def test_notify_user(
|
|||
make_user_notification_policy,
|
||||
):
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||
settings.EMAIL_HOST = "test"
|
||||
|
||||
organization = make_organization()
|
||||
user = make_user_for_organization(organization)
|
||||
|
|
@ -44,6 +45,42 @@ def test_notify_user(
|
|||
assert len(mail.outbox) == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notify_empty_email_host(
|
||||
settings,
|
||||
make_organization,
|
||||
make_user_for_organization,
|
||||
make_token_for_organization,
|
||||
make_alert_receive_channel,
|
||||
make_alert_group,
|
||||
make_alert,
|
||||
make_user_notification_policy,
|
||||
):
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||
settings.EMAIL_HOST = None
|
||||
|
||||
organization = make_organization()
|
||||
user = make_user_for_organization(organization)
|
||||
|
||||
alert_receive_channel = make_alert_receive_channel(organization)
|
||||
alert_group = make_alert_group(alert_receive_channel)
|
||||
|
||||
make_alert(alert_group=alert_group, raw_request_data=alert_receive_channel.config.example_payload)
|
||||
|
||||
notification_policy = make_user_notification_policy(
|
||||
user,
|
||||
UserNotificationPolicy.Step.NOTIFY,
|
||||
notify_by=8,
|
||||
important=False,
|
||||
)
|
||||
|
||||
notify_user_async(user.pk, alert_group.pk, notification_policy.pk)
|
||||
assert len(mail.outbox) == 0
|
||||
|
||||
log_record = notification_policy.personal_log_records.last()
|
||||
assert log_record.type == UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_FAILED
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notify_user_bad_smtp_host(
|
||||
settings,
|
||||
|
|
@ -56,6 +93,7 @@ def test_notify_user_bad_smtp_host(
|
|||
make_user_notification_policy,
|
||||
):
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||
settings.EMAIL_HOST = "test"
|
||||
|
||||
organization = make_organization()
|
||||
user = make_user_for_organization(organization)
|
||||
|
|
@ -93,6 +131,7 @@ def test_notify_user_no_emails_left(
|
|||
make_user_notification_policy,
|
||||
):
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||
settings.EMAIL_HOST = "test"
|
||||
|
||||
organization = make_organization()
|
||||
user = make_user_for_organization(organization)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ BASE_URL = os.environ.get("BASE_URL") # Root URL of OnCall backend
|
|||
# Feature toggles
|
||||
FEATURE_LIVE_SETTINGS_ENABLED = getenv_boolean("FEATURE_LIVE_SETTINGS_ENABLED", default=True)
|
||||
FEATURE_TELEGRAM_INTEGRATION_ENABLED = getenv_boolean("FEATURE_TELEGRAM_INTEGRATION_ENABLED", default=True)
|
||||
FEATURE_EMAIL_INTEGRATION_ENABLED = getenv_boolean("FEATURE_EMAIL_INTEGRATION_ENABLED", default=False)
|
||||
FEATURE_EMAIL_INTEGRATION_ENABLED = getenv_boolean("FEATURE_EMAIL_INTEGRATION_ENABLED", default=True)
|
||||
FEATURE_SLACK_INTEGRATION_ENABLED = getenv_boolean("FEATURE_SLACK_INTEGRATION_ENABLED", default=True)
|
||||
FEATURE_WEB_SCHEDULES_ENABLED = getenv_boolean("FEATURE_WEB_SCHEDULES_ENABLED", default=False)
|
||||
GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED = getenv_boolean("GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED", default=True)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
width: 725px;
|
||||
}
|
||||
|
||||
ul {
|
||||
.features-list > ul {
|
||||
margin: 20px 30px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,11 +102,13 @@ class TelegramSettings extends Component<TelegramProps, TelegramState> {
|
|||
</Block>
|
||||
<Text>
|
||||
<Text.Title level={4}>Features</Text.Title>
|
||||
<ul>
|
||||
<li>perform actions (acknowledge, resolve, silence)</li>
|
||||
<li>discuss alerts in comments</li>
|
||||
<li>notifications to users accounts will be served as links to the main channel</li>
|
||||
</ul>
|
||||
<div className={cx('features-list')}>
|
||||
<ul>
|
||||
<li>perform actions (acknowledge, resolve, silence)</li>
|
||||
<li>discuss alerts in comments</li>
|
||||
<li>notifications to users accounts will be served as links to the main channel</li>
|
||||
</ul>
|
||||
</div>
|
||||
Make sure your team connects Telegram in their OnCall user profiles too or they cannot manage alert groups.
|
||||
</Text>
|
||||
<HorizontalGroup>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue