From 24887cce839f1800761ecc52d5f8873dbe31714f Mon Sep 17 00:00:00 2001 From: UlricQin Date: Thu, 22 Jul 2021 23:34:06 +0800 Subject: [PATCH] use group get api: handle empty usergroup --- models/alert_rule_group.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/alert_rule_group.go b/models/alert_rule_group.go index 6202dbec..4cc4f43e 100644 --- a/models/alert_rule_group.go +++ b/models/alert_rule_group.go @@ -85,7 +85,12 @@ func (arg *AlertRuleGroup) FillUserGroups() error { return internalServerError } - arg.UserGroups = ugs + if len(ugs) > 0 { + arg.UserGroups = ugs + } else { + arg.UserGroups = []UserGroup{} + } + return nil }