From 1635db93c7c2679fb7bc1a604b58c254153a483a Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 25 Oct 2021 00:08:08 +0200 Subject: [PATCH] Do not check cache on deleted messages (mattermost). Fixes #1555 (#1624) --- go.mod | 2 +- go.sum | 4 ++-- matterclient/messages.go | 2 +- vendor/github.com/matterbridge/matterclient/messages.go | 2 +- vendor/modules.txt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2e2a4861..43d84e37 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba - github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d + github.com/matterbridge/matterclient v0.0.0-20211024214211-22e762684b4a github.com/mattermost/mattermost-server/v5 v5.39.0 github.com/mattermost/mattermost-server/v6 v6.0.0 github.com/mattn/godown v0.0.1 diff --git a/go.sum b/go.sum index b93c1b46..bf995f77 100644 --- a/go.sum +++ b/go.sum @@ -665,8 +665,8 @@ github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 h1:GslZKF7 github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75/go.mod h1:yAjnZ34DuDyPHMPHHjOsTk/FefW4JJjoMMCGt/8uuQA= github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba h1:XleOY4IjAEIcxAh+IFwT5JT5Ze3RHiYz6m+4ZfZ0rc0= github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba/go.mod h1:iXGEotOvwI1R1SjLxRc+BF5rUORTMtE0iMZBT2lxqAU= -github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d h1:zOIeYDh2WcqEZkJTiV5tHynjuP40IFHubliqhvfhc/0= -github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d/go.mod h1:Gh3tFUjkcPIBBeEkfXBbGio4ONMMKNmlmGECvXLY0TE= +github.com/matterbridge/matterclient v0.0.0-20211024214211-22e762684b4a h1:j5/5gEHtACfrG/Exygfjqj0ip/zRgsa8KaAyuvO2c5Y= +github.com/matterbridge/matterclient v0.0.0-20211024214211-22e762684b4a/go.mod h1:Gh3tFUjkcPIBBeEkfXBbGio4ONMMKNmlmGECvXLY0TE= github.com/mattermost/go-i18n v1.11.0 h1:1hLKqn/ZvhZ80OekjVPGYcCrBfMz+YxNNgqS+beL7zE= github.com/mattermost/go-i18n v1.11.0/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34= github.com/mattermost/gorp v1.6.2-0.20210419141818-0904a6a388d3/go.mod h1:QCQ3U0M9T/BlAdjKFJo0I1oe/YAgbyjNdhU8bpOLafk= diff --git a/matterclient/messages.go b/matterclient/messages.go index ad66462c..81c3ecbe 100644 --- a/matterclient/messages.go +++ b/matterclient/messages.go @@ -9,7 +9,7 @@ import ( func (m *MMClient) parseActionPost(rmsg *Message) { // add post to cache, if it already exists don't relay this again. // this should fix reposts - if ok, _ := m.lruCache.ContainsOrAdd(digestString(rmsg.Raw.Data["post"].(string)), true); ok { + if ok, _ := m.lruCache.ContainsOrAdd(digestString(rmsg.Raw.Data["post"].(string)), true); ok && rmsg.Raw.Event != model.WEBSOCKET_EVENT_POST_DELETED { m.logger.Debugf("message %#v in cache, not processing again", rmsg.Raw.Data["post"].(string)) rmsg.Text = "" return diff --git a/vendor/github.com/matterbridge/matterclient/messages.go b/vendor/github.com/matterbridge/matterclient/messages.go index 3b8a3acc..60363285 100644 --- a/vendor/github.com/matterbridge/matterclient/messages.go +++ b/vendor/github.com/matterbridge/matterclient/messages.go @@ -217,7 +217,7 @@ func (m *Client) UploadFile(data []byte, channelID string, filename string) (str func (m *Client) parseActionPost(rmsg *Message) { // add post to cache, if it already exists don't relay this again. // this should fix reposts - if ok, _ := m.lruCache.ContainsOrAdd(digestString(rmsg.Raw.GetData()["post"].(string)), true); ok { + if ok, _ := m.lruCache.ContainsOrAdd(digestString(rmsg.Raw.GetData()["post"].(string)), true); ok && rmsg.Raw.EventType() != model.WebsocketEventPostDeleted { m.logger.Debugf("message %#v in cache, not processing again", rmsg.Raw.GetData()["post"].(string)) rmsg.Text = "" diff --git a/vendor/modules.txt b/vendor/modules.txt index 4cf2e8d0..d588ed36 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -189,7 +189,7 @@ github.com/matterbridge/gozulipbot # github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba ## explicit github.com/matterbridge/logrus-prefixed-formatter -# github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d +# github.com/matterbridge/matterclient v0.0.0-20211024214211-22e762684b4a ## explicit; go 1.16 github.com/matterbridge/matterclient # github.com/mattermost/go-i18n v1.11.0