fix(notify): avoid duplication of notification names

This commit is contained in:
rainzm
2021-01-09 18:45:50 +08:00
parent 8b373f2d57
commit 78c16bfc03
+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
}