From 62cd191846cdd4414640f469132dcd28a1a76f3f Mon Sep 17 00:00:00 2001 From: Artem Tsyrulnikov Date: Sat, 28 Feb 2026 13:42:16 +0300 Subject: [PATCH] fix --- tg_bot/screens/creative_editor.go | 3 +++ tg_bot/screens/purchase_optional_details.go | 25 +++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tg_bot/screens/creative_editor.go b/tg_bot/screens/creative_editor.go index 6186171..e620bf9 100644 --- a/tg_bot/screens/creative_editor.go +++ b/tg_bot/screens/creative_editor.go @@ -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 { diff --git a/tg_bot/screens/purchase_optional_details.go b/tg_bot/screens/purchase_optional_details.go index 87e562c..580fae6 100644 --- a/tg_bot/screens/purchase_optional_details.go +++ b/tg_bot/screens/purchase_optional_details.go @@ -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 +}