few more improvements to blocking
Ted Unangst tedu@tedunangst.com
Fri, 26 Apr 2019 09:35:22 -0400
3 files changed,
11 insertions(+),
7 deletions(-)
M
activity.go
→
activity.go
@@ -233,6 +233,10 @@ }
if x.What == "eradicate" { return true } + if thoudostbitethythumb(user.ID, x.Honker, x.XID) { + log.Printf("not saving thumb biter %s\n", x.Honker) + return false + } return needxonkid(user, x.XID) } func needxonkid(user *WhatAbout, xid string) bool {@@ -370,7 +374,6 @@
for _, item := range items { xonk := xonkxonk(user, item) if needxonk(user, xonk) { - xonk.UserID = user.ID savexonk(user, xonk) } }@@ -548,6 +551,7 @@ audience = append(audience, who)
audience = oneofakind(audience) + xonk.UserID = user.ID xonk.What = what xonk.Honker = who xonk.XID = xid
M
fun.go
→
fun.go
@@ -324,7 +324,7 @@ ziggylock.Unlock()
return zag(r, payload) } -func thoudostbitethythumb(userid int64, who string) bool { +func thoudostbitethythumb(userid int64, who string, objid string) bool { where := "" m := re_unurl.FindStringSubmatch(who) if len(m) > 2 {@@ -333,10 +333,10 @@ }
row := stmtThumbBiter.QueryRow(who, where, userid) var id int64 err := row.Scan(&id) - if err != nil { - return false + if err == nil { + return true } - return true + return false } func keymatch(keyname string, actor string, userid int64) bool {
M
honk.go
→
honk.go
@@ -320,7 +320,8 @@ if !keymatch(keyname, who, user.ID) {
log.Printf("keyname actor mismatch: %s <> %s", keyname, who) return } - if thoudostbitethythumb(user.ID, who) { + objid, _ := jsongetstring(j, "id") + if thoudostbitethythumb(user.ID, who, objid) { log.Printf("ignoring thumb sucker %s", who) return }@@ -367,7 +368,6 @@ }
default: xonk := xonkxonk(user, j) if needxonk(user, xonk) { - xonk.UserID = user.ID savexonk(user, xonk) } }