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
bd921ca5
Commit
bd921ca5
authored
Nov 20, 2017
by
eal
Browse files
Fix posts being streamed to non-local websocket channels.
parent
edc3e5bc
Pipeline
#278
passed with stage
in 3 minutes
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
bd921ca5
...
...
@@ -286,12 +286,12 @@ def get_notified_from_activity(%Activity{data: %{"to" => to}}) do
def
get_recipients_from_activity
(%
Activity
{
data:
%{
"to"
=>
to
}})
do
query
=
from
u
in
User
,
where:
u
.
local
==
true
query
=
from
u
in
query
,
where:
u
.
ap_id
in
^
to
,
or_where:
fragment
(
"?
\\
\?| ?"
,
u
.
following
,
^
to
)
query
=
from
u
in
query
,
where:
u
.
local
==
true
Repo
.
all
(
query
)
end
...
...
test/user_test.exs
View file @
bd921ca5
...
...
@@ -318,6 +318,7 @@ test "get recipients from activity" do
assert
[
addressed
]
==
User
.
get_recipients_from_activity
(
activity
)
{
:ok
,
user
}
=
User
.
follow
(
user
,
actor
)
{
:ok
,
user_two
}
=
User
.
follow
(
user_two
,
actor
)
recipients
=
User
.
get_recipients_from_activity
(
activity
)
assert
length
(
recipients
)
==
2
assert
user
in
recipients
...
...
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