diff --git a/js/src/assets/diaspora-icon.svg b/js/src/assets/diaspora-icon.svg new file mode 100644 index 000000000..7a5b5cf3a --- /dev/null +++ b/js/src/assets/diaspora-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 50d2e0918..16446921e 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -184,11 +184,17 @@
- + + + + + + diaspora-logo + + -

@@ -591,6 +597,10 @@ export default class Event extends EventMixin { return `mailto:?to=&body=${this.event.url}${encodeURIComponent('\n\n')}${this.textDescription}&subject=${this.event.title}`; } + get diasporaShareUrl(): string { + return `https://share.diasporafoundation.org/?title=${encodeURIComponent(this.event.title)}&url=${encodeURIComponent(this.event.url)}`; + } + get textDescription(): string { const meta = document.querySelector("meta[property='og:description']"); if (!meta) return ''; @@ -899,6 +909,11 @@ export default class Event extends EventMixin { .share { border-bottom: solid 1px #111; + .diaspora span svg { + height: 2rem; + width: 2rem; + } + .columns { & > * { diff --git a/lib/mobilizon_web/email/email.ex b/lib/mobilizon_web/email/email.ex index ec12bc792..0bcb221c1 100644 --- a/lib/mobilizon_web/email/email.ex +++ b/lib/mobilizon_web/email/email.ex @@ -13,7 +13,7 @@ defmodule MobilizonWeb.Email do args |> new_email() - |> from(Config.instance_email_from()) + |> from({Config.instance_name(), Config.instance_email_from()}) |> put_header("Reply-To", Config.instance_email_reply_to()) |> assign(:instance, instance) |> put_html_layout({MobilizonWeb.EmailView, "email.html"}) diff --git a/lib/mobilizon_web/resolvers/config.ex b/lib/mobilizon_web/resolvers/config.ex index 3f13c968b..73f436f0c 100644 --- a/lib/mobilizon_web/resolvers/config.ex +++ b/lib/mobilizon_web/resolvers/config.ex @@ -15,13 +15,13 @@ defmodule MobilizonWeb.Resolvers.Config do geolix = Geolix.lookup(ip) country_code = - case geolix.city do + case Map.get(geolix, :city) do %{country: %Country{iso_code: country_code}} -> String.downcase(country_code) _ -> nil end location = - case geolix.city do + case Map.get(geolix, :city) do %{location: %Location{} = location} -> Map.from_struct(location) _ -> nil end diff --git a/lib/service/activity_pub/converter/utils.ex b/lib/service/activity_pub/converter/utils.ex index 54e815e9c..ba2f3a2af 100644 --- a/lib/service/activity_pub/converter/utils.ex +++ b/lib/service/activity_pub/converter/utils.ex @@ -15,7 +15,7 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Utils do def fetch_tags(tags) when is_list(tags) do Logger.debug("fetching tags") - Enum.reduce(tags, [], &fetch_tag/2) + tags |> Enum.flat_map(&fetch_tag/1) |> Enum.uniq() |> Enum.map(&existing_tag_or_data/1) end @spec fetch_mentions([map()]) :: [map()] @@ -64,23 +64,20 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Utils do } end - defp fetch_tag(tag, acc) when is_map(tag) do + defp fetch_tag(tag) when is_map(tag) do case tag["type"] do "Hashtag" -> - acc ++ [existing_tag_or_data(tag["name"])] + [tag_without_hash(tag["name"])] _err -> - acc + [] end end - defp fetch_tag(tag, acc) when is_bitstring(tag) do - acc ++ [existing_tag_or_data(tag)] - end + defp fetch_tag(tag) when is_bitstring(tag), do: [tag_without_hash(tag)] - defp existing_tag_or_data("#" <> tag_title) do - existing_tag_or_data(tag_title) - end + defp tag_without_hash("#" <> tag_title), do: tag_title + defp tag_without_hash(tag_title), do: tag_title defp existing_tag_or_data(tag_title) do case Events.get_tag_by_title(tag_title) do