From 7d09b8bf1b1c53399fcabaf720a3289053c4f6c3 Mon Sep 17 00:00:00 2001
From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com>
Date: Sun, 11 Aug 2024 14:04:18 +0100
Subject: [PATCH] Fix reddit crossposts & add show-flairs property
---
docs/configuration.md | 4 +++
internal/assets/templates/forum-posts.html | 6 +++-
internal/feed/primitives.go | 1 +
internal/feed/reddit.go | 34 +++++++++++++++++++---
internal/widget/reddit.go | 2 ++
5 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index 7abafe1..0f076fd 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -654,6 +654,7 @@ Example:
| subreddit | string | yes | |
| style | string | no | vertical-list |
| show-thumbnails | boolean | no | false |
+| show-flairs | boolean | no | false |
| limit | integer | no | 15 |
| collapse-after | integer | no | 5 |
| comments-url-template | string | no | https://www.reddit.com/{POST-PATH} |
@@ -690,6 +691,9 @@ Shows or hides thumbnails next to the post. This only works if the `style` is `v
>
> Thumbnails don't work for some subreddits due to Reddit's API not returning the thumbnail URL. No workaround for this yet.
+##### `show-flairs`
+Shows post flairs when set to `true`.
+
##### `limit`
The maximum number of posts to show.
diff --git a/internal/assets/templates/forum-posts.html b/internal/assets/templates/forum-posts.html
index cf9cb0d..1ada8ec 100644
--- a/internal/assets/templates/forum-posts.html
+++ b/internal/assets/templates/forum-posts.html
@@ -6,7 +6,11 @@
{{ if $.ShowThumbnails }}
- {{ if ne .ThumbnailUrl "" }}
+ {{ if .IsCrosspost }}
+
+ {{ else if ne .ThumbnailUrl "" }}

{{ else if .HasTargetUrl }}