Make atom feed compatible with multiple authors

This commit is contained in:
Jason Streifling 2024-12-01 09:59:39 +01:00
parent 81f0e46ba6
commit 8fb0733908

View File

@ -51,12 +51,18 @@ func GenerateAtomFeed(c *Config, db *DB) (*string, error) {
entry.Links[linkID].Type = "image/webp"
}
user, err := db.GetUser(c, article.AuthorID)
authors, err := db.GetArticleAuthors(c, article.ID)
if err != nil {
return nil, fmt.Errorf("error getting user info for Atom feed: %v", err)
return nil, fmt.Errorf("error getting article's authors for Atom feed: %v", err)
}
for _, author := range authors {
user, err := db.GetUser(c, author.ID)
if err != nil {
return nil, fmt.Errorf("error getting user info for Atom feed: %v", err)
}
authorID := entry.AddAuthor(atom.NewPerson(user.FirstName + " " + user.LastName))
entry.Authors[authorID].URI = c.Domain + "/image/serve/" + user.ProfilePicLink
}
authorID := entry.AddAuthor(atom.NewPerson(user.FirstName + " " + user.LastName))
entry.Authors[authorID].URI = c.Domain + "/image/serve/" + user.ProfilePicLink
tags, err := db.GetArticleTags(article.ID)
if err != nil {