部署脚本
This commit is contained in:
@@ -176,7 +176,7 @@ func ensurePlayletSlug(ctx context.Context, ac *playletmod.Playlet, excludeId in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
ac.Slug = utils.MakeRandomSlug(func(slug string) bool {
|
||||
ac.Slug = utils.MakeAbbrSlug(ac.Title, func(slug string) bool {
|
||||
filter := bson.M{playletmod.FN.Playlet.Slug: slug}
|
||||
if excludeId > 0 {
|
||||
filter[playletmod.FN.Playlet.Id] = bson.M{"$ne": excludeId}
|
||||
@@ -208,7 +208,11 @@ func preparePlayletSlugOnUpdate(ctx context.Context, id int64, info *playletmod.
|
||||
}
|
||||
return nil
|
||||
}
|
||||
newSlug := utils.MakeRandomSlug(func(s string) bool {
|
||||
title := info.Title
|
||||
if req.Title != nil {
|
||||
title = strings.TrimSpace(*req.Title)
|
||||
}
|
||||
newSlug := utils.MakeAbbrSlug(title, func(s string) bool {
|
||||
exist, _ := playletmod.FindOnePlaylet(ctx, bson.M{
|
||||
playletmod.FN.Playlet.Slug: s,
|
||||
playletmod.FN.Playlet.Id: bson.M{"$ne": id},
|
||||
|
||||
Reference in New Issue
Block a user