From 94e45ae56f7172f71b1a250e3ff47b6c199398f7 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 4 Feb 2020 11:30:13 -0500 Subject: [PATCH] require replyto to exist (would crash otherwise anyway) --- activity.go | 13 ------------- web.go | 16 +++++++--------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/activity.go b/activity.go index c0a53fc..a7d599a 100644 --- a/activity.go +++ b/activity.go @@ -381,19 +381,6 @@ func gimmexonks(user *WhatAbout, outbox string) { } } -func whosthere(xid string) ([]string, string) { - obj, err := GetJunk(xid) - if err != nil { - log.Printf("error getting remote xonk: %s", err) - return nil, "" - } - convoy, _ := obj.GetString("context") - if convoy == "" { - convoy, _ = obj.GetString("conversation") - } - return newphone(nil, obj), convoy -} - func newphone(a []string, obj junk.Junk) []string { for _, addr := range []string{"to", "cc", "attributedTo"} { who, _ := obj.GetString(addr) diff --git a/web.go b/web.go index bb007c6..4e4eb01 100644 --- a/web.go +++ b/web.go @@ -1476,16 +1476,14 @@ func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) { var convoy string if rid != "" { xonk := getxonk(userinfo.UserID, rid) - if xonk != nil { - if xonk.Public { - honk.Audience = append(honk.Audience, xonk.Audience...) - } - convoy = xonk.Convoy - } else { - xonkaud, c := whosthere(rid) - honk.Audience = append(honk.Audience, xonkaud...) - convoy = c + if xonk == nil { + http.Error(w, "replyto disappeared", http.StatusNotFound) + return } + if xonk.Public { + honk.Audience = append(honk.Audience, xonk.Audience...) + } + convoy = xonk.Convoy for i, a := range honk.Audience { if a == thewholeworld { honk.Audience[0], honk.Audience[i] = honk.Audience[i], honk.Audience[0]