mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-18 04:49:23 +00:00
Save remote users with fqn as nickname.
This commit is contained in:
parent
ba1ea77001
commit
20015b4b67
|
@ -96,10 +96,12 @@ defmodule Pleroma.Web.OStatus do
|
||||||
data = %{
|
data = %{
|
||||||
local: false,
|
local: false,
|
||||||
name: info.name,
|
name: info.name,
|
||||||
nickname: info.nickname,
|
nickname: info.nickname <> "@" <> info.host,
|
||||||
ap_id: info.uri,
|
ap_id: info.uri,
|
||||||
info: info
|
info: info
|
||||||
}
|
}
|
||||||
|
# TODO: Make remote user changeset
|
||||||
|
# SHould enforce fqn nickname
|
||||||
Repo.insert(Ecto.Changeset.change(%User{}, data))
|
Repo.insert(Ecto.Changeset.change(%User{}, data))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -139,7 +139,8 @@ defmodule Pleroma.Web.Websub do
|
||||||
uri: uri,
|
uri: uri,
|
||||||
hub: hub,
|
hub: hub,
|
||||||
nickname: preferredUsername || name,
|
nickname: preferredUsername || name,
|
||||||
name: displayName || name
|
name: displayName || name,
|
||||||
|
host: URI.parse(uri).host
|
||||||
}}
|
}}
|
||||||
else e ->
|
else e ->
|
||||||
{:error, e}
|
{:error, e}
|
||||||
|
|
|
@ -33,7 +33,7 @@ defmodule Pleroma.Web.OStatusTest do
|
||||||
|
|
||||||
user = Repo.get(Pleroma.User, user.id)
|
user = Repo.get(Pleroma.User, user.id)
|
||||||
assert user.name == "Constance Variable"
|
assert user.name == "Constance Variable"
|
||||||
assert user.nickname == "lambadalambda"
|
assert user.nickname == "lambadalambda@social.heldscal.la"
|
||||||
assert user.local == false
|
assert user.local == false
|
||||||
assert user.info["uri"] == uri
|
assert user.info["uri"] == uri
|
||||||
assert user.ap_id == uri
|
assert user.ap_id == uri
|
||||||
|
@ -60,6 +60,7 @@ defmodule Pleroma.Web.OStatusTest do
|
||||||
subject: "acct:shp@social.heldscal.la",
|
subject: "acct:shp@social.heldscal.la",
|
||||||
topic: "https://social.heldscal.la/api/statuses/user_timeline/29191.atom",
|
topic: "https://social.heldscal.la/api/statuses/user_timeline/29191.atom",
|
||||||
uri: "https://social.heldscal.la/user/29191",
|
uri: "https://social.heldscal.la/user/29191",
|
||||||
|
host: "social.heldscal.la",
|
||||||
fqn: user
|
fqn: user
|
||||||
}
|
}
|
||||||
assert data == expected
|
assert data == expected
|
||||||
|
@ -80,6 +81,7 @@ defmodule Pleroma.Web.OStatusTest do
|
||||||
subject: "https://social.heldscal.la/user/29191",
|
subject: "https://social.heldscal.la/user/29191",
|
||||||
topic: "https://social.heldscal.la/api/statuses/user_timeline/29191.atom",
|
topic: "https://social.heldscal.la/api/statuses/user_timeline/29191.atom",
|
||||||
uri: "https://social.heldscal.la/user/29191",
|
uri: "https://social.heldscal.la/user/29191",
|
||||||
|
host: "social.heldscal.la",
|
||||||
fqn: user
|
fqn: user
|
||||||
}
|
}
|
||||||
assert data == expected
|
assert data == expected
|
||||||
|
|
|
@ -118,7 +118,8 @@ defmodule Pleroma.Web.WebsubTest do
|
||||||
hub: "https://mastodon.social/api/push",
|
hub: "https://mastodon.social/api/push",
|
||||||
uri: "https://mastodon.social/users/lambadalambda",
|
uri: "https://mastodon.social/users/lambadalambda",
|
||||||
nickname: "lambadalambda",
|
nickname: "lambadalambda",
|
||||||
name: "Critical Value"
|
name: "Critical Value",
|
||||||
|
host: "mastodon.social"
|
||||||
}
|
}
|
||||||
|
|
||||||
assert expected == discovered
|
assert expected == discovered
|
||||||
|
|
Loading…
Reference in a new issue