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