few more improvements to blocking

This commit is contained in:
Ted Unangst 2019-04-26 09:35:22 -04:00
parent e21a9b009b
commit 9e726bde40
3 changed files with 11 additions and 7 deletions

View File

@ -233,6 +233,10 @@ func needxonk(user *WhatAbout, x *Honk) bool {
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 @@ func peeppeep() {
for _, item := range items {
xonk := xonkxonk(user, item)
if needxonk(user, xonk) {
xonk.UserID = user.ID
savexonk(user, xonk)
}
}
@ -548,6 +551,7 @@ func xonkxonk(user *WhatAbout, item interface{}) *Honk {
audience = oneofakind(audience)
xonk.UserID = user.ID
xonk.What = what
xonk.Honker = who
xonk.XID = xid

8
fun.go
View File

@ -324,7 +324,7 @@ func makeitworksomehowwithoutregardforkeycontinuity(keyname string, r *http.Requ
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 @@ func thoudostbitethythumb(userid int64, who string) bool {
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 {

View File

@ -320,7 +320,8 @@ func inbox(w http.ResponseWriter, r *http.Request) {
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 @@ func inbox(w http.ResponseWriter, r *http.Request) {
default:
xonk := xonkxonk(user, j)
if needxonk(user, xonk) {
xonk.UserID = user.ID
savexonk(user, xonk)
}
}