forked from potsda.mn/mobilizon
Various changes needed for AP refactor
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
78dc7613bc
commit
caf9493a00
|
@ -192,9 +192,6 @@ export default class ParticipationSection extends Vue {
|
||||||
if (this.event.draft || this.event.status === EventStatus.CANCELLED)
|
if (this.event.draft || this.event.status === EventStatus.CANCELLED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Organizer can't participate
|
|
||||||
if (this.actorIsOrganizer) return false;
|
|
||||||
|
|
||||||
// If capacity is OK
|
// If capacity is OK
|
||||||
if (this.eventCapacityOK) return true;
|
if (this.eventCapacityOK) return true;
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ defmodule Mobilizon.Federation.ActivityPub.Actor do
|
||||||
{:error, "Can't make a local actor from URL"}
|
{:error, "Can't make a local actor from URL"}
|
||||||
else
|
else
|
||||||
case Fetcher.fetch_and_prepare_actor_from_url(url) do
|
case Fetcher.fetch_and_prepare_actor_from_url(url) do
|
||||||
|
# Just in case
|
||||||
|
{:ok, {:error, _e}} ->
|
||||||
|
raise ArgumentError, message: "Failed to make actor from url #{url}"
|
||||||
|
|
||||||
{:ok, data} ->
|
{:ok, data} ->
|
||||||
Actors.upsert_actor(data, preload)
|
Actors.upsert_actor(data, preload)
|
||||||
|
|
||||||
|
@ -67,7 +71,7 @@ defmodule Mobilizon.Federation.ActivityPub.Actor do
|
||||||
{:error, :http_error}
|
{:error, :http_error}
|
||||||
|
|
||||||
{:error, e} ->
|
{:error, e} ->
|
||||||
Logger.warn("Failed to make actor from url")
|
Logger.warn("Failed to make actor from url #{url}")
|
||||||
{:error, e}
|
{:error, e}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -476,6 +476,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
|
||||||
"type" => "Update",
|
"type" => "Update",
|
||||||
"to" => object["to"],
|
"to" => object["to"],
|
||||||
"cc" => object["cc"],
|
"cc" => object["cc"],
|
||||||
|
"attributedTo" => object["attributedTo"] || object["actor"],
|
||||||
"actor" => object["actor"],
|
"actor" => object["actor"],
|
||||||
"object" => object,
|
"object" => object,
|
||||||
"id" => object["id"] <> "/activity"
|
"id" => object["id"] <> "/activity"
|
||||||
|
|
|
@ -158,6 +158,7 @@ defmodule Mobilizon.Factory do
|
||||||
deleted_at: nil,
|
deleted_at: nil,
|
||||||
tags: build_list(3, :tag),
|
tags: build_list(3, :tag),
|
||||||
in_reply_to_comment: nil,
|
in_reply_to_comment: nil,
|
||||||
|
origin_comment: nil,
|
||||||
is_announcement: false,
|
is_announcement: false,
|
||||||
published_at: DateTime.utc_now(),
|
published_at: DateTime.utc_now(),
|
||||||
url: Routes.page_url(Endpoint, :comment, uuid)
|
url: Routes.page_url(Endpoint, :comment, uuid)
|
||||||
|
@ -450,4 +451,12 @@ defmodule Mobilizon.Factory do
|
||||||
user: build(:user)
|
user: build(:user)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def share_factory do
|
||||||
|
%Mobilizon.Share{
|
||||||
|
actor: build(:actor),
|
||||||
|
owner_actor: build(:actor),
|
||||||
|
uri: sequence("https://someshare.uri/p/12")
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue