From 87b37a4153381403289c5b2e6dc455b547088e73 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 8 Feb 2022 15:27:17 +0100 Subject: [PATCH] Expose isOnline through AP Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/utils.ex | 4 ++++ lib/federation/activity_stream/converter/event.ex | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/federation/activity_pub/utils.ex b/lib/federation/activity_pub/utils.ex index aadb90ca8..c810b4d53 100644 --- a/lib/federation/activity_pub/utils.ex +++ b/lib/federation/activity_pub/utils.ex @@ -112,6 +112,10 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do "@id" => "mz:participationMessage", "@type" => "sc:Text" }, + "isOnline" => %{ + "@type" => "sc:Boolean", + "@id" => "mz:isOnline" + }, "PropertyValue" => "sc:PropertyValue", "value" => "sc:value", "propertyID" => "sc:propertyID", diff --git a/lib/federation/activity_stream/converter/event.ex b/lib/federation/activity_stream/converter/event.ex index 1ec250b16..9acaf1094 100644 --- a/lib/federation/activity_stream/converter/event.ex +++ b/lib/federation/activity_stream/converter/event.ex @@ -139,7 +139,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do "url" => event.url, "inLanguage" => event.language, "timezone" => event.options.timezone, - "contacts" => Enum.map(event.contacts, & &1.url) + "contacts" => Enum.map(event.contacts, & &1.url), + "isOnline" => event.options.is_online } |> maybe_add_physical_address(event) |> maybe_add_event_picture(event) @@ -168,7 +169,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do "repliesModerationOption", if(Map.get(object, "commentsEnabled", true), do: :allow_all, else: :closed) ), - timezone: calculate_timezone(object, address) + timezone: calculate_timezone(object, address), + is_online: object["isOnline"] == true } end