ActivityPub: Ingest information about chat acceptance.
This commit is contained in:
parent
8289ec67a8
commit
5c0bf4c472
|
@ -437,7 +437,8 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do
|
||||||
:discoverable,
|
:discoverable,
|
||||||
:invisible,
|
:invisible,
|
||||||
:actor_type,
|
:actor_type,
|
||||||
:also_known_as
|
:also_known_as,
|
||||||
|
:accepts_chat_messages
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|> validate_required([:name, :ap_id])
|
|> validate_required([:name, :ap_id])
|
||||||
|
|
|
@ -1224,6 +1224,7 @@ defp object_to_user_data(data) do
|
||||||
end)
|
end)
|
||||||
|
|
||||||
locked = data["manuallyApprovesFollowers"] || false
|
locked = data["manuallyApprovesFollowers"] || false
|
||||||
|
accepts_chat_messages = data["acceptsChatMessages"]
|
||||||
data = Transmogrifier.maybe_fix_user_object(data)
|
data = Transmogrifier.maybe_fix_user_object(data)
|
||||||
discoverable = data["discoverable"] || false
|
discoverable = data["discoverable"] || false
|
||||||
invisible = data["invisible"] || false
|
invisible = data["invisible"] || false
|
||||||
|
@ -1262,7 +1263,8 @@ defp object_to_user_data(data) do
|
||||||
also_known_as: Map.get(data, "alsoKnownAs", []),
|
also_known_as: Map.get(data, "alsoKnownAs", []),
|
||||||
public_key: public_key,
|
public_key: public_key,
|
||||||
inbox: data["inbox"],
|
inbox: data["inbox"],
|
||||||
shared_inbox: shared_inbox
|
shared_inbox: shared_inbox,
|
||||||
|
accepts_chat_messages: accepts_chat_messages
|
||||||
}
|
}
|
||||||
|
|
||||||
# nickname can be nil because of virtual actors
|
# nickname can be nil because of virtual actors
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
"summary": "\u003cp\u003e\u003c/p\u003e",
|
"summary": "\u003cp\u003e\u003c/p\u003e",
|
||||||
"url": "http://mastodon.example.org/@admin",
|
"url": "http://mastodon.example.org/@admin",
|
||||||
"manuallyApprovesFollowers": false,
|
"manuallyApprovesFollowers": false,
|
||||||
|
"acceptsChatMessages": true,
|
||||||
"publicKey": {
|
"publicKey": {
|
||||||
"id": "http://mastodon.example.org/users/admin#main-key",
|
"id": "http://mastodon.example.org/users/admin#main-key",
|
||||||
"owner": "http://mastodon.example.org/users/admin",
|
"owner": "http://mastodon.example.org/users/admin",
|
||||||
|
|
|
@ -184,6 +184,14 @@ test "it returns a user that is invisible" do
|
||||||
assert User.invisible?(user)
|
assert User.invisible?(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it returns a user that accepts chat messages" do
|
||||||
|
user_id = "http://mastodon.example.org/users/admin"
|
||||||
|
{:ok, user} = ActivityPub.make_user_from_ap_id(user_id)
|
||||||
|
|
||||||
|
assert user.accepts_chat_messages
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "it fetches the appropriate tag-restricted posts" do
|
test "it fetches the appropriate tag-restricted posts" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
@ -214,7 +222,6 @@ test "it fetches the appropriate tag-restricted posts" do
|
||||||
assert fetch_three == [status_one, status_two]
|
assert fetch_three == [status_one, status_two]
|
||||||
assert fetch_four == [status_three]
|
assert fetch_four == [status_three]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
describe "insertion" do
|
describe "insertion" do
|
||||||
test "drops activities beyond a certain limit" do
|
test "drops activities beyond a certain limit" do
|
||||||
|
|
Loading…
Reference in a new issue