From 19556e2020ae7da47b6f399a1c74e5b115825341 Mon Sep 17 00:00:00 2001 From: BreadMakesYouFat Date: Fri, 23 Jun 2023 16:53:54 -0400 Subject: [PATCH] resolves mrusme/neonmodem#32 Filter for lemmy communities --- system/lemmy/lemmy.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system/lemmy/lemmy.go b/system/lemmy/lemmy.go index 36bc7ec..a733e9c 100644 --- a/system/lemmy/lemmy.go +++ b/system/lemmy/lemmy.go @@ -188,11 +188,21 @@ func (sys *System) ListPosts(forumID string) ([]post.Post, error) { return []post.Post{}, err } + var communityID int + var showAll bool + communityID, err = strconv.Atoi(forumID) + if err != nil { + showAll = true + } + cfg := sys.GetConfig() baseURL := cfg["url"].(string) var models []post.Post for _, i := range resp.Posts { + if (!showAll) && i.Post.CommunityID != communityID { + continue + } t := "post" body := i.Post.Body.ValueOr("") if i.Post.URL.IsValid() {