Skip to content

Commit

Permalink
filter post_content only for post_type = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
weber-s committed Feb 23, 2024
1 parent 6ae6ffa commit 016347b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dalec_discourse/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ def _fetch_latest_topics(self, nb, channel=None, channel_object=None):
post_url = "{}/t/{}/{}/{}".format(
settings.DALEC_DISCOURSE_BASE_URL, topic["slug"], topic["id"], topic["posts_count"]
)
post_content = client.post(topic_id=topic["id"], post_id=topic["posts_count"])[
"post_stream"
]["posts"][-1]
posts = client.post(topic_id=topic["id"], post_id=topic["posts_count"])["post_stream"][
"posts"
]
# Get latest post with post_type == 1 (i.e. real content, not update)
post_content = list(filter(lambda x: x["post_type"] == 1, posts))[-1]

topic["id"] = str(topic["id"])
if not topic["last_posted_at"]:
Expand Down

0 comments on commit 016347b

Please sign in to comment.