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
5ff5d583
Commit
5ff5d583
authored
Nov 19, 2017
by
lain
Browse files
MastodonAPI: Streaming fixes.
Now shows repeats in the home tl.
parent
f6495abf
Pipeline
#267
failed with stage
in 2 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/activity_pub/activity_pub.ex
View file @
5ff5d583
...
...
@@ -10,6 +10,7 @@ def insert(map, local \\ true) when is_map(map) do
:ok
<-
insert_full_object
(
map
)
do
{
:ok
,
activity
}
=
Repo
.
insert
(%
Activity
{
data:
map
,
local:
local
,
actor:
map
[
"actor"
]})
Notification
.
create_notifications
(
activity
)
stream_out
(
activity
)
{
:ok
,
activity
}
else
%
Activity
{}
=
activity
->
{
:ok
,
activity
}
...
...
@@ -17,17 +18,22 @@ def insert(map, local \\ true) when is_map(map) do
end
end
def
create
(
to
,
actor
,
context
,
object
,
additional
\\
%{},
published
\\
nil
,
local
\\
true
)
do
with
create_data
<-
make_create_data
(%{
to:
to
,
actor:
actor
,
published:
published
,
context:
context
,
object:
object
},
additional
),
{
:ok
,
activity
}
<-
insert
(
create_data
,
local
),
:ok
<-
maybe_federate
(
activity
)
do
if
activity
.
data
[
"type"
]
==
"Create"
and
Enum
.
member?
(
activity
.
data
[
"to"
],
"https://www.w3.org/ns/activitystreams#Public"
)
do
def
stream_out
(
activity
)
do
if
activity
.
data
[
"type"
]
in
[
"Create"
,
"Announce"
]
do
Pleroma
.
Web
.
Streamer
.
stream
(
"user"
,
activity
)
if
Enum
.
member?
(
activity
.
data
[
"to"
],
"https://www.w3.org/ns/activitystreams#Public"
)
do
Pleroma
.
Web
.
Streamer
.
stream
(
"public"
,
activity
)
Pleroma
.
Web
.
Streamer
.
stream
(
"user"
,
activity
)
if
local
do
if
activity
.
local
do
Pleroma
.
Web
.
Streamer
.
stream
(
"public:local"
,
activity
)
end
end
end
end
def
create
(
to
,
actor
,
context
,
object
,
additional
\\
%{},
published
\\
nil
,
local
\\
true
)
do
with
create_data
<-
make_create_data
(%{
to:
to
,
actor:
actor
,
published:
published
,
context:
context
,
object:
object
},
additional
),
{
:ok
,
activity
}
<-
insert
(
create_data
,
local
),
:ok
<-
maybe_federate
(
activity
)
do
{
:ok
,
activity
}
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