diff options
author | Marc Coquand <marcc@fastmail.fr> | 2023-12-02 11:25:36 -0600 |
---|---|---|
committer | Marc Coquand <marcc@fastmail.fr> | 2023-12-02 11:25:36 -0600 |
commit | 189179574d847e8e9662cf78804ce9371fac988d (patch) | |
tree | 0cc2b8c27fe8cf59d4724100d8b95085fab6432d /lib/post.ml | |
parent | 4fe8c79ce03e12be04b0d928b65b1a7d475f4458 (diff) | |
download | wormhole-189179574d847e8e9662cf78804ce9371fac988d.tar.gz wormhole-189179574d847e8e9662cf78804ce9371fac988d.tar.bz2 wormhole-189179574d847e8e9662cf78804ce9371fac988d.zip |
Add user
Diffstat (limited to 'lib/post.ml')
-rw-r--r-- | lib/post.ml | 21 |
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:"" |