From dd8070d9e5182e936faa5415a6f0d508a4dbfa8e Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Thu, 6 Dec 2018 15:33:46 +0300 Subject: [PATCH 1/2] add max chars count in channel settings --- go.mod | 4 +++- go.sum | 6 ++++++ src/main.go | 1 + src/routing.go | 9 +++++---- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 99af2e7..6ad3fe9 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,9 @@ require ( github.com/pkg/errors v0.8.0 github.com/pmezard/go-difflib v1.0.0 // indirect github.com/retailcrm/api-client-go v1.1.0 - github.com/retailcrm/mg-transport-api-client-go v1.1.17 + github.com/retailcrm/mg-transport-api-client-go v1.1.18 + github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect + github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 // indirect github.com/stretchr/testify v1.2.2 github.com/technoweenie/multipartstreamer v1.0.1 // indirect diff --git a/go.sum b/go.sum index 1584ae8..9848a8c 100644 --- a/go.sum +++ b/go.sum @@ -89,6 +89,12 @@ github.com/retailcrm/api-client-go v1.1.0 h1:APPO6ccJAeMV7Jz7BhrtDKSOm2r1j5Ft6fu github.com/retailcrm/api-client-go v1.1.0/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c= github.com/retailcrm/mg-transport-api-client-go v1.1.17 h1:8L0meFJFZwr3TyiF/xypI+g0xRXIGkWhyQ6qiCfojqw= github.com/retailcrm/mg-transport-api-client-go v1.1.17/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI= +github.com/retailcrm/mg-transport-api-client-go v1.1.18 h1:V59Ai79N1jrS1kAnQggNoRYsoAdr2RUV7Hf0xbw9r9Q= +github.com/retailcrm/mg-transport-api-client-go v1.1.18/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI= +github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co= +github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo= +github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 h1:4bT0pPowCpQImewr+BjzfUKcuFW+KVyB8d1OF3b6oTI= github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50/go.mod h1:1pdIZTAHUz+HDKDVZ++5xg/duPlhKAIzw9qy42CWYp4= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= diff --git a/src/main.go b/src/main.go index 35e8319..1a1ee8d 100644 --- a/src/main.go +++ b/src/main.go @@ -15,6 +15,7 @@ type Options struct { } const Type = "telegram" +const MaxCharsCount = 4096 var ( config *TransportConfig diff --git a/src/routing.go b/src/routing.go index 372b941..fea45a5 100644 --- a/src/routing.go +++ b/src/routing.go @@ -330,10 +330,11 @@ func getChannelSettings(cid ...uint64) v1.Channel { Read: v1.ChannelFeatureNone, }, Text: v1.ChannelSettingsText{ - Creating: v1.ChannelFeatureBoth, - Editing: v1.ChannelFeatureBoth, - Quoting: v1.ChannelFeatureBoth, - Deleting: v1.ChannelFeatureReceive, + Creating: v1.ChannelFeatureBoth, + Editing: v1.ChannelFeatureBoth, + Quoting: v1.ChannelFeatureBoth, + Deleting: v1.ChannelFeatureReceive, + MaxCharsCount: MaxCharsCount, }, Product: v1.Product{ Creating: v1.ChannelFeatureReceive, From 4ea49123333250daddee99d999f2265cc2c4ed2d Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Thu, 6 Dec 2018 16:01:06 +0300 Subject: [PATCH 2/2] fix test --- src/main.go | 2 +- src/routing_test.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.go b/src/main.go index 1a1ee8d..347dd3e 100644 --- a/src/main.go +++ b/src/main.go @@ -15,7 +15,7 @@ type Options struct { } const Type = "telegram" -const MaxCharsCount = 4096 +const MaxCharsCount uint16 = 4096 var ( config *TransportConfig diff --git a/src/routing_test.go b/src/routing_test.go index 2504e8c..c7b1a41 100644 --- a/src/routing_test.go +++ b/src/routing_test.go @@ -66,10 +66,11 @@ func TestRouting_addBotHandler(t *testing.T) { Read: v1.ChannelFeatureNone, }, Text: v1.ChannelSettingsText{ - Creating: v1.ChannelFeatureBoth, - Editing: v1.ChannelFeatureBoth, - Quoting: v1.ChannelFeatureBoth, - Deleting: v1.ChannelFeatureReceive, + Creating: v1.ChannelFeatureBoth, + Editing: v1.ChannelFeatureBoth, + Quoting: v1.ChannelFeatureBoth, + Deleting: v1.ChannelFeatureReceive, + MaxCharsCount: MaxCharsCount, }, Product: v1.Product{ Creating: v1.ChannelFeatureReceive,