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
4807a522
Commit
4807a522
authored
Aug 06, 2018
by
kaniini
Browse files
user: support creating an actor which represents the instance itself
parent
d7368ea2
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
4807a522
...
...
@@ -637,6 +637,22 @@ def get_or_fetch_by_ap_id(ap_id) do
end
end
def
get_or_create_instance_user
do
if
user
=
get_by_ap_id
(
Pleroma
.
Web
.
Endpoint
.
url
())
do
user
else
changes
=
%
User
{}
|>
cast
(%{},
[
:ap_id
,
:nickname
,
:local
])
|>
put_change
(
:ap_id
,
Pleroma
.
Web
.
Endpoint
.
url
())
|>
put_change
(
:nickname
,
nil
)
|>
put_change
(
:local
,
true
)
{
:ok
,
user
}
=
Repo
.
insert
(
changes
)
user
end
end
# AP style
def
public_key_from_info
(%{
"source_data"
=>
%{
"publicKey"
=>
%{
"publicKeyPem"
=>
public_key_pem
}}
...
...
Write
Preview
Markdown
is supported
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