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
f20e8d28
Commit
f20e8d28
authored
Apr 02, 2019
by
Sachin Joshi
Browse files
add support for all status type (ostatus) and replase case with if
parent
6386c1c9
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/pleroma/web/twitter_api/controllers/util_controller.ex
View file @
f20e8d28
...
...
@@ -74,13 +74,11 @@ def remote_subscribe(conn, %{"user" => %{"nickname" => nick, "profile" => profil
end
def
remote_follow
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"acct"
=>
acct
})
do
case
is_status?
(
acct
)
do
true
->
if
is_status?
(
acct
)
do
{
:ok
,
object
}
=
ActivityPub
.
fetch_object_from_id
(
acct
)
%
Activity
{
id:
activity_id
}
=
Activity
.
get_create_by_object_ap_id
(
object
.
data
[
"id"
])
redirect
(
conn
,
to:
"/notice/
#{
activity_id
}
"
)
false
->
else
{
err
,
followee
}
=
OStatus
.
find_or_make_user
(
acct
)
avatar
=
User
.
avatar_url
(
followee
)
name
=
followee
.
nickname
...
...
@@ -104,8 +102,11 @@ def remote_follow(%{assigns: %{user: user}} = conn, %{"acct" => acct}) do
defp
is_status?
(
acct
)
do
case
ActivityPub
.
fetch_and_contain_remote_object_from_id
(
acct
)
do
{
:ok
,
%{
"type"
=>
"Note"
}}
->
true
_
->
false
{
:ok
,
%{
"type"
=>
type
}}
when
type
in
[
"Article"
,
"Note"
,
"Video"
,
"Page"
,
"Question"
]
->
true
_
->
false
end
end
...
...
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