fix(notify): avoid duplication of notification names

This commit is contained in:
rainzm
2021-01-09 18:42:54 +08:00
parent 552223ae59
commit 07114b53d9
+5 -1
View File
@@ -128,7 +128,11 @@ func (nm *SNotificationManager) ValidateCreateData(ctx context.Context, userCred
if len(input.Topic) < 10 {
length = len(input.Topic)
}
input.Name = fmt.Sprintf("%s-%s-%s", input.Topic[:length], input.ContactType, nowStr)
name := fmt.Sprintf("%s-%s-%s", input.Topic[:length], input.ContactType, nowStr)
input.Name, err = db.GenerateName(nm, ownerId, name)
if err != nil {
return input, errors.Wrapf(err, "unable to generate name for %s", name)
}
return input, nil
}