[MM-11143] Strip markdown formatting characters from push notifications (#17775)

* WIP: trim markdown for push notification

* fix: golangci

* fix: table regex

* fix: regex code block

* doc: add license

* WIP: custom renderer with goldmark

* WIP: update goldmark version to 1.38

* fix: use goldmark as parser

* fix: remove table extension

* fix: change buf to `strings.Builder`

* fix: return original string, log warning if error

* refactor: change `WriteString` to `WriteByte`

* refactor: change if condition

* refactor: use assertion

* refactor: move to inline

* fix: remove handle multiline

Already handled by mobile

* refactor: wrap same function

* refactor: move strip markdown to `sendPushNotificationSync`

* refactor: renaming variable aren't used

* fix: move log to func `sendPushNotificationSync`

* docs: add comment to `StripMarkdown`

* fix: move assign message to else

* appErr to err rename

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ahmad Karlam
2021-06-29 10:24:13 +07:00
коммит произвёл GitHub
родитель 2d8857b72e
Коммит 081f4a5123
57 изменённых файлов: 15870 добавлений и 22 удалений

6
go.mod
Просмотреть файл

@@ -59,7 +59,7 @@ require (
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
github.com/jmoiron/sqlx v1.3.4
github.com/jonboulle/clockwork v0.2.2
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
@@ -95,13 +95,12 @@ require (
github.com/pierrec/lz4/v4 v4.1.7 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.25.0 // indirect
github.com/reflog/dateconstraints v0.2.1
github.com/rs/cors v1.7.0
github.com/rs/xid v1.3.0 // indirect
github.com/rudderlabs/analytics-go v3.3.1+incompatible
github.com/russellhaering/goxmldsig v1.1.0
github.com/russellhaering/goxmldsig v1.1.0 // indirect
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
github.com/sirupsen/logrus v1.8.1
@@ -123,6 +122,7 @@ require (
github.com/wiggin77/srslog v1.0.1
github.com/willf/bitset v1.1.11 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c
github.com/yuin/goldmark v1.3.8
go.etcd.io/bbolt v1.3.6 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.17.0