mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Ignore message edits to prevent duplicate URL previews and stat inflation
Matrix edits arrive as m.room.message with m.replace relation. Without filtering these out, each edit was re-triggering URL previews and incrementing user stats as if it were a new message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
6
main.go
6
main.go
@@ -203,6 +203,12 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore edits — they arrive as m.room.message with m.replace relation.
|
||||||
|
// Without this check, edits re-trigger URL previews and inflate stats.
|
||||||
|
if content.RelatesTo != nil && content.RelatesTo.Type == event.RelReplace {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
body := content.Body
|
body := content.Body
|
||||||
// Strip Matrix reply fallback: "> <@user:server> ..." lines followed by blank line
|
// Strip Matrix reply fallback: "> <@user:server> ..." lines followed by blank line
|
||||||
if strings.HasPrefix(body, "> <@") || strings.HasPrefix(body, "> * <@") {
|
if strings.HasPrefix(body, "> <@") || strings.HasPrefix(body, "> * <@") {
|
||||||
|
|||||||
Reference in New Issue
Block a user