Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
20015b4b
Commit
20015b4b
authored
Apr 29, 2017
by
lain
Browse files
Save remote users with fqn as nickname.
parent
ba1ea770
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/ostatus/ostatus.ex
View file @
20015b4b
...
...
@@ -96,10 +96,12 @@ def make_user(uri) do
data
=
%{
local:
false
,
name:
info
.
name
,
nickname:
info
.
nickname
,
nickname:
info
.
nickname
<>
"@"
<>
info
.
host
,
ap_id:
info
.
uri
,
info:
info
}
# TODO: Make remote user changeset
# SHould enforce fqn nickname
Repo
.
insert
(
Ecto
.
Changeset
.
change
(%
User
{},
data
))
end
end
...
...
lib/pleroma/web/websub/websub.ex
View file @
20015b4b
...
...
@@ -139,7 +139,8 @@ def gather_feed_data(topic, getter \\ &HTTPoison.get/1) do
uri:
uri
,
hub:
hub
,
nickname:
preferredUsername
||
name
,
name:
displayName
||
name
name:
displayName
||
name
,
host:
URI
.
parse
(
uri
)
.
host
}}
else
e
->
{
:error
,
e
}
...
...
test/web/ostatus/ostatus_test.exs
View file @
20015b4b
...
...
@@ -33,7 +33,7 @@ test "tries to use the information in poco fields" do
user
=
Repo
.
get
(
Pleroma
.
User
,
user
.
id
)
assert
user
.
name
==
"Constance Variable"
assert
user
.
nickname
==
"lambadalambda"
assert
user
.
nickname
==
"lambadalambda
@social.heldscal.la
"
assert
user
.
local
==
false
assert
user
.
info
[
"uri"
]
==
uri
assert
user
.
ap_id
==
uri
...
...
@@ -60,6 +60,7 @@ test "it returns user info in a hash" do
subject:
"acct:shp@social.heldscal.la"
,
topic:
"https://social.heldscal.la/api/statuses/user_timeline/29191.atom"
,
uri:
"https://social.heldscal.la/user/29191"
,
host:
"social.heldscal.la"
,
fqn:
user
}
assert
data
==
expected
...
...
@@ -80,6 +81,7 @@ test "it works with the uri" do
subject:
"https://social.heldscal.la/user/29191"
,
topic:
"https://social.heldscal.la/api/statuses/user_timeline/29191.atom"
,
uri:
"https://social.heldscal.la/user/29191"
,
host:
"social.heldscal.la"
,
fqn:
user
}
assert
data
==
expected
...
...
test/web/websub/websub_test.exs
View file @
20015b4b
...
...
@@ -118,7 +118,8 @@ test "discovers the hub and canonical url" do
hub:
"https://mastodon.social/api/push"
,
uri:
"https://mastodon.social/users/lambadalambda"
,
nickname:
"lambadalambda"
,
name:
"Critical Value"
name:
"Critical Value"
,
host:
"mastodon.social"
}
assert
expected
==
discovered
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment