Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Allan Nordhøy
funkwhale
Commits
24b8ca72
Verified
Commit
24b8ca72
authored
6 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Removed dead code
parent
752a06c2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/federation/activity.py
+0
-12
0 additions, 12 deletions
api/funkwhale_api/federation/activity.py
api/tests/federation/test_activity.py
+2
-21
2 additions, 21 deletions
api/tests/federation/test_activity.py
with
2 additions
and
33 deletions
api/funkwhale_api/federation/activity.py
+
0
−
12
View file @
24b8ca72
...
...
@@ -386,15 +386,3 @@ def get_actors_from_audience(urls):
if
not
final_query
:
return
models
.
Actor
.
objects
.
none
()
return
models
.
Actor
.
objects
.
filter
(
final_query
)
def
get_inbox_urls
(
actor_queryset
):
"""
Given an actor queryset, returns a deduplicated set containing
all inbox or shared inbox urls where we should deliver our payloads for
those actors
"""
values
=
actor_queryset
.
values
(
"
inbox_url
"
,
"
shared_inbox_url
"
)
urls
=
set
([
actor
[
"
shared_inbox_url
"
]
or
actor
[
"
inbox_url
"
]
for
actor
in
values
])
return
sorted
(
urls
)
This diff is collapsed.
Click to expand it.
api/tests/federation/test_activity.py
+
2
−
21
View file @
24b8ca72
...
...
@@ -78,22 +78,6 @@ def test_get_actors_from_audience_urls(settings, db):
assert
str
(
activity
.
get_actors_from_audience
(
urls
).
query
)
==
str
(
expected
.
query
)
def
test_get_inbox_urls
(
factories
):
a1
=
factories
[
"
federation.Actor
"
](
shared_inbox_url
=
None
,
inbox_url
=
"
https://a1.inbox
"
)
a2
=
factories
[
"
federation.Actor
"
](
shared_inbox_url
=
"
https://shared.inbox
"
,
inbox_url
=
"
https://a2.inbox
"
)
factories
[
"
federation.Actor
"
](
shared_inbox_url
=
"
https://shared.inbox
"
,
inbox_url
=
"
https://a3.inbox
"
)
expected
=
sorted
(
set
([
a1
.
inbox_url
,
a2
.
shared_inbox_url
]))
assert
activity
.
get_inbox_urls
(
a1
.
__class__
.
objects
.
all
())
==
expected
def
test_receive_invalid_data
(
factories
):
remote_actor
=
factories
[
"
federation.Actor
"
]()
a
=
{
"
@context
"
:
[],
"
actor
"
:
remote_actor
.
fid
,
"
id
"
:
"
https://test.activity
"
}
...
...
@@ -212,9 +196,6 @@ def test_outbox_router_dispatch(mocker, factories, now):
"
actor
"
:
actor
,
}
expected_deliveries_url
=
activity
.
get_inbox_urls
(
models
.
Actor
.
objects
.
filter
(
pk__in
=
[
r1
.
pk
,
r2
.
pk
])
)
router
.
connect
({
"
type
"
:
"
Noop
"
},
handler
)
activities
=
router
.
dispatch
({
"
type
"
:
"
Noop
"
},
{
"
summary
"
:
"
hello
"
})
a
=
activities
[
0
]
...
...
@@ -235,8 +216,8 @@ def test_outbox_router_dispatch(mocker, factories, now):
assert
a
.
uuid
is
not
None
assert
a
.
deliveries
.
count
()
==
2
for
url
in
expected_deliveries_url
:
delivery
=
a
.
deliveries
.
get
(
inbox_url
=
url
)
for
actor
in
[
r1
,
r2
]
:
delivery
=
a
.
deliveries
.
get
(
inbox_url
=
actor
.
inbox_
url
)
assert
delivery
.
is_delivered
is
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment