fix
This commit is contained in:
@@ -334,6 +334,9 @@ func (e *CreativeEditorFields) SendCreativePreview(b *bot.Bot) {
|
||||
}
|
||||
} else if len(res.Result) > 0 {
|
||||
msgID = res.Result[0].ID
|
||||
for i := 1; i < len(res.Result); i++ {
|
||||
e.ExtraMediaMessageIDs = append(e.ExtraMediaMessageIDs, res.Result[i].ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if media := e.primaryMedia(); media != nil {
|
||||
|
||||
@@ -2618,7 +2618,10 @@ func (s *PurchaseOptionalDetails) buildChannelDetails(channelKey string, placeme
|
||||
// Placement type
|
||||
if s.PurchaseTypeMode == "per_channel" && len(s.Channels) > 1 {
|
||||
if value, ok := s.PurchaseTypeByChannel[channelKey]; ok && value != "" {
|
||||
details.PlacementType = &value
|
||||
normalized := normalizePurchaseTypeValue(value)
|
||||
if normalized != nil {
|
||||
details.PlacementType = normalized
|
||||
}
|
||||
}
|
||||
} else if placementType != nil {
|
||||
details.PlacementType = placementType
|
||||
@@ -2691,21 +2694,29 @@ func (s *PurchaseOptionalDetails) isChannelDetailsEmpty(details *backend.Placeme
|
||||
details.InviteLinkType == nil
|
||||
}
|
||||
|
||||
func (s *PurchaseOptionalDetails) normalizePurchaseType() (*string, bool) {
|
||||
raw := strings.TrimSpace(s.PurchaseType)
|
||||
func normalizePurchaseTypeValue(raw string) *string {
|
||||
raw = strings.TrimSpace(raw)
|
||||
if raw == "" {
|
||||
return nil, true
|
||||
return nil
|
||||
}
|
||||
normalized := strings.ToLower(raw)
|
||||
normalized = strings.TrimSpace(strings.Trim(normalized, "."))
|
||||
switch normalized {
|
||||
case "взаимный пиар", "взаимнопиар", "mutual_pr", "mutual pr", "вп", "vp":
|
||||
value := "mutual_pr"
|
||||
return &value, true
|
||||
return &value
|
||||
case "стандарт", "standard":
|
||||
value := "standard"
|
||||
return &value, true
|
||||
return &value
|
||||
default:
|
||||
return nil, false
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PurchaseOptionalDetails) normalizePurchaseType() (*string, bool) {
|
||||
result := normalizePurchaseTypeValue(s.PurchaseType)
|
||||
if s.PurchaseType == "" {
|
||||
return nil, true
|
||||
}
|
||||
return result, result != nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user