Do not check cache on deleted messages (mattermost). Fixes #1555 (#1624)

This commit is contained in:
Wim 2021-10-25 00:08:08 +02:00 committed by GitHub
parent c4fe462d11
commit 1635db93c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

2
go.mod
View File

@ -27,7 +27,7 @@ require (
github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba 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/v5 v5.39.0
github.com/mattermost/mattermost-server/v6 v6.0.0 github.com/mattermost/mattermost-server/v6 v6.0.0
github.com/mattn/godown v0.0.1 github.com/mattn/godown v0.0.1

4
go.sum
View File

@ -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/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 h1:XleOY4IjAEIcxAh+IFwT5JT5Ze3RHiYz6m+4ZfZ0rc0=
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba/go.mod h1:iXGEotOvwI1R1SjLxRc+BF5rUORTMtE0iMZBT2lxqAU= 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-20211024214211-22e762684b4a h1:j5/5gEHtACfrG/Exygfjqj0ip/zRgsa8KaAyuvO2c5Y=
github.com/matterbridge/matterclient v0.0.0-20211021135437-2dc2bc7dce2d/go.mod h1:Gh3tFUjkcPIBBeEkfXBbGio4ONMMKNmlmGECvXLY0TE= 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 h1:1hLKqn/ZvhZ80OekjVPGYcCrBfMz+YxNNgqS+beL7zE=
github.com/mattermost/go-i18n v1.11.0/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34= 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= github.com/mattermost/gorp v1.6.2-0.20210419141818-0904a6a388d3/go.mod h1:QCQ3U0M9T/BlAdjKFJo0I1oe/YAgbyjNdhU8bpOLafk=

View File

@ -9,7 +9,7 @@ import (
func (m *MMClient) parseActionPost(rmsg *Message) { func (m *MMClient) parseActionPost(rmsg *Message) {
// add post to cache, if it already exists don't relay this again. // add post to cache, if it already exists don't relay this again.
// this should fix reposts // 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)) m.logger.Debugf("message %#v in cache, not processing again", rmsg.Raw.Data["post"].(string))
rmsg.Text = "" rmsg.Text = ""
return return

View File

@ -217,7 +217,7 @@ func (m *Client) UploadFile(data []byte, channelID string, filename string) (str
func (m *Client) parseActionPost(rmsg *Message) { func (m *Client) parseActionPost(rmsg *Message) {
// add post to cache, if it already exists don't relay this again. // add post to cache, if it already exists don't relay this again.
// this should fix reposts // 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)) m.logger.Debugf("message %#v in cache, not processing again", rmsg.Raw.GetData()["post"].(string))
rmsg.Text = "" rmsg.Text = ""

2
vendor/modules.txt vendored
View File

@ -189,7 +189,7 @@ github.com/matterbridge/gozulipbot
# github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba # github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
## explicit ## explicit
github.com/matterbridge/logrus-prefixed-formatter 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 ## explicit; go 1.16
github.com/matterbridge/matterclient github.com/matterbridge/matterclient
# github.com/mattermost/go-i18n v1.11.0 # github.com/mattermost/go-i18n v1.11.0