From 189179574d847e8e9662cf78804ce9371fac988d Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sat, 2 Dec 2023 11:25:36 -0600 Subject: Add user --- lib/post.ml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib/post.ml') 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:"" -- cgit v1.2.3