From 741b53e0c511ba4fddcf793802374ec385dc095c Mon Sep 17 00:00:00 2001 From: Cameron Aaron Date: Sat, 30 Mar 2024 16:33:47 -0700 Subject: [PATCH 1/4] trying to get this merged --- portal.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/portal.go b/portal.go index 967de9f..2d1ea86 100644 --- a/portal.go +++ b/portal.go @@ -453,12 +453,7 @@ func (portal *Portal) markRead(intent *appservice.IntentAPI, eventID id.EventID, return nil } - // Only send the read update if it is more recent than the last read time - if portal.ReadAt.After(readAt) { - return nil - } else { - portal.ReadAt = readAt - } + portal.ReadAt = readAt var extra CustomReadReceipt if intent == portal.bridge.user.DoublePuppetIntent { @@ -2143,11 +2138,6 @@ func (portal *Portal) HandleiMessage(msg *imessage.Message) id.EventID { // If the message exists in the database, handle edits or retractions if dbMessage != nil && dbMessage.MXID != "" { - // Clean up the text so the length is accurate - msg.Text = strings.ReplaceAll(msg.Text, "\ufffc", "") - msg.Subject = strings.ReplaceAll(msg.Subject, "\ufffc", "") - - // DEVNOTE: It seems sometimes the message is just edited to remove data instead of actually retracting it if msg.IsRetracted || (len(msg.Attachments) == 0 && len(msg.Text) == 0 && len(msg.Subject) == 0) { @@ -2159,7 +2149,7 @@ func (portal *Portal) HandleiMessage(msg *imessage.Message) id.EventID { } overrideSuccess = true - } else if msg.IsEdited { + } else if msg.IsEdited && dbMessage.Part == 0 { // Edit existing message intent := portal.getIntentForMessage(msg, nil) From 9f7883c8f2a9f6fe877e93cde079ad32f3b7f86e Mon Sep 17 00:00:00 2001 From: Cameron Aaron Date: Sat, 30 Mar 2024 16:40:27 -0700 Subject: [PATCH 2/4] removed field --- portal.go | 1 - 1 file changed, 1 deletion(-) diff --git a/portal.go b/portal.go index 2d1ea86..09abcd6 100644 --- a/portal.go +++ b/portal.go @@ -453,7 +453,6 @@ func (portal *Portal) markRead(intent *appservice.IntentAPI, eventID id.EventID, return nil } - portal.ReadAt = readAt var extra CustomReadReceipt if intent == portal.bridge.user.DoublePuppetIntent { From 9ac5031771db7b0f3097adc80b55984e596ab2d9 Mon Sep 17 00:00:00 2001 From: Cameron Aaron Date: Sat, 30 Mar 2024 17:06:39 -0700 Subject: [PATCH 3/4] like this? --- portal.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/portal.go b/portal.go index 09abcd6..a8811cd 100644 --- a/portal.go +++ b/portal.go @@ -217,7 +217,6 @@ func (br *IMBridge) NewPortal(dbPortal *database.Portal) *Portal { MessageStatuses: make(chan *imessage.SendMessageStatus, 100), MatrixMessages: make(chan *event.Event, 100), backfillStart: make(chan struct{}), - ReadAt: time.Now(), } portal.log = maulogadapt.ZeroAsMau(&portal.zlog) if !br.IM.Capabilities().MessageSendResponses { @@ -254,7 +253,6 @@ type Portal struct { messageDedup map[string]SentMessage messageDedupLock sync.Mutex Identifier imessage.Identifier - ReadAt time.Time userIsTyping bool typingLock sync.Mutex From bfea7d6436c34f155b7c5ee9a3db372133a80ac5 Mon Sep 17 00:00:00 2001 From: Cameron Aaron Date: Sat, 30 Mar 2024 21:26:17 -0700 Subject: [PATCH 4/4] like this? --- portal.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/portal.go b/portal.go index a8811cd..029c39e 100644 --- a/portal.go +++ b/portal.go @@ -2134,6 +2134,7 @@ func (portal *Portal) HandleiMessage(msg *imessage.Message) id.EventID { // If the message exists in the database, handle edits or retractions if dbMessage != nil && dbMessage.MXID != "" { + // DEVNOTE: It seems sometimes the message is just edited to remove data instead of actually retracting it if msg.IsRetracted || (len(msg.Attachments) == 0 && len(msg.Text) == 0 && len(msg.Subject) == 0) { @@ -2146,7 +2147,7 @@ func (portal *Portal) HandleiMessage(msg *imessage.Message) id.EventID { } overrideSuccess = true - } else if msg.IsEdited && dbMessage.Part == 0 { + } else if msg.IsEdited && dbMessage.Part > 0 { // Edit existing message intent := portal.getIntentForMessage(msg, nil)