Commit Diff


commit - a439d275a8384994f6408e51de38553275fba918
commit + 5802ed4c60289ae4fdd8bd233135f643717e8d51
blob - 3501d481db3d7c8fc4ae0c37bf21e1787f61ba69
blob + 737cdeff0457724aa4257ced480808449601ece2
--- fs/file.go
+++ fs/file.go
@@ -132,7 +132,7 @@ func postFile(p *lemmy.Post) *dummy {
 	buf := &bytes.Buffer{}
 	fmt.Fprintln(buf, "From:", p.CreatorID)
 	fmt.Fprintf(buf, "Message-Id: <%d>\n", p.ID)
-	fmt.Fprintf(buf, "List-Archive: <%s>\n", p.ActivityURL)
+	fmt.Fprintf(buf, "List-Archive: <%s>\n", p.URL)
 	fmt.Fprintln(buf, "Date:", p.ModTime().Format(time.RFC822))
 	fmt.Fprintln(buf, "Subject:", p.Title)
 	fmt.Fprintln(buf)
@@ -148,21 +148,13 @@ func postFile(p *lemmy.Post) *dummy {
 	}
 }
 
-func commentFile(c *lemmy.Comment, person lemmy.Person, post lemmy.Post) *dummy {
+func commentFile(c *lemmy.Comment) *dummy {
 	buf := &bytes.Buffer{}
-	fmt.Fprintln(buf, "From:", person.String())
+	fmt.Fprintln(buf, "From:", c.CreatorID)
 	fmt.Fprintln(buf, "Date:", c.ModTime().Format(time.RFC822))
-	fmt.Fprintf(buf, "Message-Id: <%d>\n", c.ID)
+	fmt.Fprintf(buf, "Message-ID: <%d>\n", c.ID)
 	fmt.Fprintf(buf, "List-Archive: <%s>\n", c.ActivityURL)
-	fmt.Fprintln(buf, "Subject: Re:", post.Title)
-
-	refs, err := c.References()
-	if err != nil || len(refs) <= 2 {
-		fmt.Fprintf(buf, "References: <%d>\n", c.PostID)
-	} else {
-		fmt.Fprintf(buf, "References: <%d>\n", refs[len(refs)-2])
-	}
-
+	fmt.Fprintln(buf, "Subject: Re:", c.PostID)
 	fmt.Fprintln(buf)
 	fmt.Fprintln(buf, c.Content)
 	return &dummy{
blob - 0c8f335984284995fb3d46ebb73e9eb9a761bdd9
blob + 6d1f3609b1b649e5af5e55d0971bae105b3cfaf3
--- fs/fs.go
+++ fs/fs.go
@@ -95,14 +95,14 @@ func (fsys *FS) Open(name string) (fs.File, error) {
 		return nil, &fs.PathError{"open", name, fmt.Errorf("bad post/comment id")}
 	}
 
-	comment, creator, post, err := fsys.Client.LookupComment(id)
+	comment, err := fsys.Client.LookupComment(id)
 	if err == nil {
-		return commentFile(&comment, creator, post), nil
+		return commentFile(&comment), nil
 	} else if !errors.Is(err, lemmy.ErrNotFound) {
 		return nil, &fs.PathError{"open", name, err}
 	}
 
-	post, err = fsys.Client.LookupPost(id)
+	post, err := fsys.Client.LookupPost(comment.PostID)
 	if errors.Is(err, lemmy.ErrNotFound) {
 		return nil, &fs.PathError{"open", name, fs.ErrNotExist}
 	} else if err != nil {