refine delivery some more

This commit is contained in:
Ted Unangst 2019-04-16 20:14:24 -04:00
parent 5a435960be
commit 3d0cb6c737
1 changed files with 13 additions and 9 deletions

View File

@ -607,17 +607,23 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
} }
func honkworldwide(user *WhatAbout, honk *Honk) { func honkworldwide(user *WhatAbout, honk *Honk) {
rcpts := make(map[string]bool)
for _, a := range honk.Audience {
if a != thewholeworld && a != user.URL {
rcpts[a] = true
}
}
jonk, _ := jonkjonk(user, honk) jonk, _ := jonkjonk(user, honk)
jonk["@context"] = itiswhatitis jonk["@context"] = itiswhatitis
var buf bytes.Buffer var buf bytes.Buffer
WriteJunk(&buf, jonk) WriteJunk(&buf, jonk)
msg := buf.Bytes() msg := buf.Bytes()
rcpts := make(map[string]bool)
for _, a := range honk.Audience {
if a != thewholeworld && a != user.URL && !strings.HasSuffix(a, "/followers") {
box, _ := getboxes(a)
if box != nil && box.Shared != "" {
rcpts["%"+box.Shared] = true
} else {
rcpts[a] = true
}
}
}
for _, f := range getdubs(user.ID) { for _, f := range getdubs(user.ID) {
box, _ := getboxes(f.XID) box, _ := getboxes(f.XID)
if box != nil && box.Shared != "" { if box != nil && box.Shared != "" {
@ -627,10 +633,8 @@ func honkworldwide(user *WhatAbout, honk *Honk) {
} }
} }
for a := range rcpts { for a := range rcpts {
if !strings.HasSuffix(a, "/followers") {
deliverate(0, user.Name, a, msg) deliverate(0, user.Name, a, msg)
} }
}
} }
func asjonker(user *WhatAbout) map[string]interface{} { func asjonker(user *WhatAbout) map[string]interface{} {