From 2d087fb810072379e50064230f381808220942de Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 22 Sep 2019 09:24:18 +0200 Subject: [PATCH] Move Mobilizon.Events.Activity to Mobilizon.Service.ActivityPub.Activity It's only used for ActivityPub stuff, nothing DB related. Signed-off-by: Thomas Citharel --- lib/mobilizon_web/api/events.ex | 1 + lib/mobilizon_web/api/reports.ex | 2 +- lib/mobilizon_web/resolvers/comment.ex | 4 ++-- lib/mobilizon_web/resolvers/event.ex | 3 ++- lib/mobilizon_web/resolvers/group.ex | 2 +- lib/mobilizon_web/views/activity_pub/actor_view.ex | 2 +- lib/mobilizon_web/views/activity_pub/object_view.ex | 3 +-- lib/{mobilizon/events => service/activity_pub}/activity.ex | 2 +- lib/service/activity_pub/activity_pub.ex | 7 +++---- lib/service/activity_pub/relay.ex | 2 +- lib/service/activity_pub/transmogrifier.ex | 3 +-- lib/service/activity_pub/utils.ex | 4 ++-- lib/service/activity_pub/visibility.ex | 2 +- lib/service/federator.ex | 3 +-- mix.exs | 2 +- .../mobilizon/service/activity_pub/transmogrifier_test.exs | 4 ++-- test/mobilizon_web/api/report_test.exs | 3 ++- 17 files changed, 24 insertions(+), 25 deletions(-) rename lib/{mobilizon/events => service/activity_pub}/activity.ex (86%) diff --git a/lib/mobilizon_web/api/events.ex b/lib/mobilizon_web/api/events.ex index 6a9493a25..55a05dbde 100644 --- a/lib/mobilizon_web/api/events.ex +++ b/lib/mobilizon_web/api/events.ex @@ -5,6 +5,7 @@ defmodule MobilizonWeb.API.Events do alias Mobilizon.Events.Event alias Mobilizon.Service.ActivityPub alias Mobilizon.Service.ActivityPub.Utils, as: ActivityPubUtils + alias Mobilizon.Service.ActivityPub.Activity alias MobilizonWeb.API.Utils @doc """ diff --git a/lib/mobilizon_web/api/reports.ex b/lib/mobilizon_web/api/reports.ex index 06480e944..ad5cfa0bf 100644 --- a/lib/mobilizon_web/api/reports.ex +++ b/lib/mobilizon_web/api/reports.ex @@ -9,7 +9,7 @@ defmodule MobilizonWeb.API.Reports do alias Mobilizon.Actors alias Mobilizon.Actors.Actor alias Mobilizon.Events - alias Mobilizon.Events.Activity + alias Mobilizon.Service.ActivityPub.Activity alias Mobilizon.Reports, as: ReportsAction alias Mobilizon.Reports.{Report, Note} alias Mobilizon.Service.ActivityPub diff --git a/lib/mobilizon_web/resolvers/comment.ex b/lib/mobilizon_web/resolvers/comment.ex index cbe0b248b..d00b610ce 100644 --- a/lib/mobilizon_web/resolvers/comment.ex +++ b/lib/mobilizon_web/resolvers/comment.ex @@ -3,9 +3,9 @@ defmodule MobilizonWeb.Resolvers.Comment do Handles the comment-related GraphQL calls """ - alias Mobilizon.Events.{Activity, Comment} + alias Mobilizon.Events.Comment alias Mobilizon.Users.User - + alias Mobilizon.Service.ActivityPub.Activity alias MobilizonWeb.API.Comments require Logger diff --git a/lib/mobilizon_web/resolvers/event.ex b/lib/mobilizon_web/resolvers/event.ex index c50089604..d3aff4f94 100644 --- a/lib/mobilizon_web/resolvers/event.ex +++ b/lib/mobilizon_web/resolvers/event.ex @@ -6,12 +6,13 @@ defmodule MobilizonWeb.Resolvers.Event do alias Mobilizon.Addresses alias Mobilizon.Addresses.Address alias Mobilizon.Events - alias Mobilizon.Events.{Activity, Event, Participant} + alias Mobilizon.Events.{Event, Participant} alias Mobilizon.Media.Picture alias Mobilizon.Users.User alias Mobilizon.Actors alias Mobilizon.Actors.Actor alias MobilizonWeb.Resolvers.Person + alias Mobilizon.Service.ActivityPub.Activity import Mobilizon.Service.Admin.ActionLogService # We limit the max number of events that can be retrieved diff --git a/lib/mobilizon_web/resolvers/group.ex b/lib/mobilizon_web/resolvers/group.ex index ccc565aa7..a7330970f 100644 --- a/lib/mobilizon_web/resolvers/group.ex +++ b/lib/mobilizon_web/resolvers/group.ex @@ -4,7 +4,7 @@ defmodule MobilizonWeb.Resolvers.Group do """ alias Mobilizon.Actors alias Mobilizon.Actors.{Actor, Member} - alias Mobilizon.Events.Activity + alias Mobilizon.Service.ActivityPub.Activity alias Mobilizon.Users.User alias Mobilizon.Service.ActivityPub diff --git a/lib/mobilizon_web/views/activity_pub/actor_view.ex b/lib/mobilizon_web/views/activity_pub/actor_view.ex index c1679bb53..b37c5848b 100644 --- a/lib/mobilizon_web/views/activity_pub/actor_view.ex +++ b/lib/mobilizon_web/views/activity_pub/actor_view.ex @@ -3,7 +3,7 @@ defmodule MobilizonWeb.ActivityPub.ActorView do alias Mobilizon.Actors alias Mobilizon.Actors.Actor - alias Mobilizon.Events.Activity + alias Mobilizon.Service.ActivityPub.Activity alias Mobilizon.Service.ActivityPub alias Mobilizon.Service.ActivityPub.Utils diff --git a/lib/mobilizon_web/views/activity_pub/object_view.ex b/lib/mobilizon_web/views/activity_pub/object_view.ex index 576b9e751..4ad2b9fee 100644 --- a/lib/mobilizon_web/views/activity_pub/object_view.ex +++ b/lib/mobilizon_web/views/activity_pub/object_view.ex @@ -1,8 +1,7 @@ defmodule MobilizonWeb.ActivityPub.ObjectView do use MobilizonWeb, :view - alias Mobilizon.Events.Activity - alias Mobilizon.Service.ActivityPub.Utils + alias Mobilizon.Service.ActivityPub.{Activity, Utils} def render("activity.json", %{activity: %Activity{local: local, data: data} = activity}) do %{ diff --git a/lib/mobilizon/events/activity.ex b/lib/service/activity_pub/activity.ex similarity index 86% rename from lib/mobilizon/events/activity.ex rename to lib/service/activity_pub/activity.ex index f3febd324..d0be2e2c0 100644 --- a/lib/mobilizon/events/activity.ex +++ b/lib/service/activity_pub/activity.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Events.Activity do +defmodule Mobilizon.Service.ActivityPub.Activity do @moduledoc """ Represents an activity. """ diff --git a/lib/service/activity_pub/activity_pub.ex b/lib/service/activity_pub/activity_pub.ex index fbda9acd0..5dab5b12e 100644 --- a/lib/service/activity_pub/activity_pub.ex +++ b/lib/service/activity_pub/activity_pub.ex @@ -12,7 +12,7 @@ defmodule Mobilizon.Service.ActivityPub do alias Mobilizon.Config alias Mobilizon.Events - alias Mobilizon.Events.{Activity, Event, Comment, Participant} + alias Mobilizon.Events.{Event, Comment, Participant} alias Mobilizon.Service.ActivityPub.Transmogrifier alias Mobilizon.Service.WebFinger @@ -22,11 +22,10 @@ defmodule Mobilizon.Service.ActivityPub do alias Mobilizon.Service.Federator alias Mobilizon.Service.HTTPSignatures.Signature - alias Mobilizon.Service.ActivityPub.Convertible + alias Mobilizon.Service.ActivityPub.{Activity, Convertible} require Logger - import Mobilizon.Service.ActivityPub.Utils - import Mobilizon.Service.ActivityPub.Visibility + import Mobilizon.Service.ActivityPub.{Utils, Visibility} @doc """ Get recipients for an activity or object diff --git a/lib/service/activity_pub/relay.ex b/lib/service/activity_pub/relay.ex index ef44fbbea..7b4396a1f 100644 --- a/lib/service/activity_pub/relay.ex +++ b/lib/service/activity_pub/relay.ex @@ -10,7 +10,7 @@ defmodule Mobilizon.Service.ActivityPub.Relay do alias Mobilizon.Actors alias Mobilizon.Actors.Actor - alias Mobilizon.Events.Activity + alias Mobilizon.Service.ActivityPub.Activity alias Mobilizon.Service.ActivityPub alias MobilizonWeb.API.Follows diff --git a/lib/service/activity_pub/transmogrifier.ex b/lib/service/activity_pub/transmogrifier.ex index 41d81c246..ef34e1477 100644 --- a/lib/service/activity_pub/transmogrifier.ex +++ b/lib/service/activity_pub/transmogrifier.ex @@ -12,8 +12,7 @@ defmodule Mobilizon.Service.ActivityPub.Transmogrifier do alias Mobilizon.Events alias Mobilizon.Events.{Event, Comment, Participant} alias Mobilizon.Service.ActivityPub - alias Mobilizon.Service.ActivityPub.Utils - alias Mobilizon.Service.ActivityPub.Visibility + alias Mobilizon.Service.ActivityPub.{Visibility, Utils} require Logger diff --git a/lib/service/activity_pub/utils.ex b/lib/service/activity_pub/utils.ex index 04230abdc..9f9caf2c0 100644 --- a/lib/service/activity_pub/utils.ex +++ b/lib/service/activity_pub/utils.ex @@ -17,11 +17,11 @@ defmodule Mobilizon.Service.ActivityPub.Utils do alias Mobilizon.Actors alias Mobilizon.Actors.Actor alias Mobilizon.Events - alias Mobilizon.Events.{Activity, Comment, Event} + alias Mobilizon.Events.{Comment, Event} alias Mobilizon.Media.Picture alias Mobilizon.Reports alias Mobilizon.Reports.Report - alias Mobilizon.Service.ActivityPub.Converters + alias Mobilizon.Service.ActivityPub.{Activity, Converters} alias Mobilizon.Storage.Repo alias Mobilizon.Users diff --git a/lib/service/activity_pub/visibility.ex b/lib/service/activity_pub/visibility.ex index 756965910..adca3e2aa 100644 --- a/lib/service/activity_pub/visibility.ex +++ b/lib/service/activity_pub/visibility.ex @@ -8,7 +8,7 @@ defmodule Mobilizon.Service.ActivityPub.Visibility do Utility functions related to content visibility """ - alias Mobilizon.Events.Activity + alias Mobilizon.Service.ActivityPub.Activity @public "https://www.w3.org/ns/activitystreams#Public" diff --git a/lib/service/federator.ex b/lib/service/federator.ex index 041e87fcb..a0051706a 100644 --- a/lib/service/federator.ex +++ b/lib/service/federator.ex @@ -11,9 +11,8 @@ defmodule Mobilizon.Service.Federator do use GenServer alias Mobilizon.Actors - alias Mobilizon.Events.Activity alias Mobilizon.Service.ActivityPub - alias Mobilizon.Service.ActivityPub.Transmogrifier + alias Mobilizon.Service.ActivityPub.{Activity, Transmogrifier} require Logger diff --git a/mix.exs b/mix.exs index 853a977ee..68a3a619d 100644 --- a/mix.exs +++ b/mix.exs @@ -197,7 +197,7 @@ defmodule Mobilizon.Mixfile do Mobilizon.Addresses, Mobilizon.Addresses.Address, Mobilizon.Events, - Mobilizon.Events.Activity, + Mobilizon.Service.ActivityPub.Activity, Mobilizon.Events.Event, Mobilizon.Events.Comment, Mobilizon.Events.FeedToken, diff --git a/test/mobilizon/service/activity_pub/transmogrifier_test.exs b/test/mobilizon/service/activity_pub/transmogrifier_test.exs index 4db06e085..19b816139 100644 --- a/test/mobilizon/service/activity_pub/transmogrifier_test.exs +++ b/test/mobilizon/service/activity_pub/transmogrifier_test.exs @@ -11,9 +11,9 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do alias Mobilizon.Actors alias Mobilizon.Actors.Actor alias Mobilizon.Events - alias Mobilizon.Events.{Activity, Comment, Event, Participant} + alias Mobilizon.Events.{Comment, Event, Participant} alias Mobilizon.Service.ActivityPub - alias Mobilizon.Service.ActivityPub.Utils + alias Mobilizon.Service.ActivityPub.{Utils, Activity} alias Mobilizon.Service.ActivityPub.Transmogrifier use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney diff --git a/test/mobilizon_web/api/report_test.exs b/test/mobilizon_web/api/report_test.exs index 8c85e4fc7..9ff39b988 100644 --- a/test/mobilizon_web/api/report_test.exs +++ b/test/mobilizon_web/api/report_test.exs @@ -4,10 +4,11 @@ defmodule MobilizonWeb.API.ReportTest do import Mobilizon.Factory alias Mobilizon.Actors.Actor - alias Mobilizon.Events.{Activity, Comment, Event} + alias Mobilizon.Events.{Comment, Event} alias Mobilizon.Reports.{Report, Note} alias Mobilizon.Users alias Mobilizon.Users.User + alias Mobilizon.Service.ActivityPub.Activity alias MobilizonWeb.API.Reports