From 1acb85d047a5bf5a5f92b6079e06cd161959e910 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 14 Apr 2019 10:15:47 -0400 Subject: [PATCH] we can ignore incoming xonks that originated as self --- activity.go | 9 ++++++--- honk.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/activity.go b/activity.go index 65f4de5..4e4862f 100644 --- a/activity.go +++ b/activity.go @@ -217,8 +217,11 @@ func savedonk(url string, name, media string) *Donk { return &donk } -func needxonk(userid int64, x *Honk) bool { - row := stmtFindXonk.QueryRow(userid, x.XID) +func needxonk(user *WhatAbout, x *Honk) bool { + if strings.HasPrefix(x.XID, user.URL + "/h/") { + return false + } + row := stmtFindXonk.QueryRow(user.ID, x.XID) err := row.Scan(&x.ID) if err == nil { return false @@ -314,7 +317,7 @@ func peeppeep() { for _, item := range items { xonk := xonkxonk(item) - if xonk != nil && needxonk(user.ID, xonk) { + if xonk != nil && needxonk(user, xonk) { xonk.UserID = user.ID savexonk(xonk) } diff --git a/honk.go b/honk.go index 5489031..78ce459 100644 --- a/honk.go +++ b/honk.go @@ -335,7 +335,7 @@ func inbox(w http.ResponseWriter, r *http.Request) { } default: xonk := xonkxonk(j) - if xonk != nil && needxonk(user.ID, xonk) { + if xonk != nil && needxonk(user, xonk) { xonk.UserID = user.ID savexonk(xonk) }