fix update activity

This commit is contained in:
Ted Unangst 2020-05-01 01:34:08 -04:00
parent 835b6efe84
commit 751245469e
3 changed files with 14 additions and 6 deletions

View File

@ -1272,7 +1272,7 @@ func collectiveaction(honk *Honk) {
} }
} }
func junkuser(user *WhatAbout) []byte { func junkuser(user *WhatAbout) junk.Junk {
about := markitzero(user.About) about := markitzero(user.About)
j := junk.New() j := junk.New()
@ -1306,7 +1306,7 @@ func junkuser(user *WhatAbout) []byte {
k["publicKeyPem"] = user.Key k["publicKeyPem"] = user.Key
j["publicKey"] = k j["publicKey"] = k
return j.ToBytes() return j
} }
var oldjonkers = cache.New(cache.Options{Filler: func(name string) ([]byte, bool) { var oldjonkers = cache.New(cache.Options{Filler: func(name string) ([]byte, bool) {
@ -1314,7 +1314,10 @@ var oldjonkers = cache.New(cache.Options{Filler: func(name string) ([]byte, bool
if err != nil { if err != nil {
return nil, false return nil, false
} }
return junkuser(user), true var buf bytes.Buffer
j := junkuser(user)
j.Write(&buf)
return buf.Bytes(), true
}, Duration: 1 * time.Minute}) }, Duration: 1 * time.Minute})
func asjonker(name string) ([]byte, bool) { func asjonker(name string) ([]byte, bool) {
@ -1535,8 +1538,7 @@ func updateMe(username string) {
j["published"] = dt j["published"] = dt
j["to"] = []string{thewholeworld, user.URL + "/followers"} j["to"] = []string{thewholeworld, user.URL + "/followers"}
j["type"] = "Update" j["type"] = "Update"
jo, _ := asjonker(username) j["object"] = junkuser(user)
j["object"] = jo
msg := j.ToBytes() msg := j.ToBytes()

View File

@ -1,5 +1,11 @@
changelog changelog
=== next
+ Fix update activity.
+ A few API refinements and additions.
=== 0.9.0 Monitor vs Merrimack === 0.9.0 Monitor vs Merrimack
--- Add Reactions. --- Add Reactions.

2
web.go
View File

@ -562,7 +562,7 @@ func serveractor(w http.ResponseWriter, r *http.Request) {
return return
} }
j := junkuser(user) j := junkuser(user)
w.Write(j) j.Write(w)
} }
func ximport(w http.ResponseWriter, r *http.Request) { func ximport(w http.ResponseWriter, r *http.Request) {