aboutsummaryrefslogtreecommitdiff
path: root/lib/post.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/post.ml')
-rw-r--r--lib/post.ml21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/post.ml b/lib/post.ml
index 232d9a7..3b63a11 100644
--- a/lib/post.ml
+++ b/lib/post.ml
@@ -25,10 +25,25 @@ type mastodon_post = {
}
[@@deriving yojson] [@@yojson.allow_extra_fields]
-let post_of_mastodon_post = function
+let mastodon_actor post = post.actor
+
+let post_of_mastodon_post actor_name = function
| { actor; published; obj = { tag } } ->
- let tags = List.map (fun { name; _ } -> name) tag in
- { link = actor; summary = published; tags; published; author = actor }
+ let tags =
+ List.filter_map
+ (fun { name; kind; _ } ->
+ (* This would normally be filtered with yojson, but I couldn't get
+ it to work *)
+ if kind = "Hashtag" then Some name else None)
+ tag
+ in
+ {
+ link = actor;
+ summary = published;
+ tags;
+ published;
+ author = actor_name;
+ }
let get_tld (link : string) =
Uri.of_string link |> Uri.host_with_default ~default:""