Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
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
csaurus
pleroma
Commits
866a2663
Commit
866a2663
authored
8 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Add fetching of activities in context.
parent
ae50b165
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pleroma/web/activity_pub/activity_pub.ex
+6
-0
6 additions, 0 deletions
lib/pleroma/web/activity_pub/activity_pub.ex
test/web/activity_pub/activity_pub_test.exs
+12
-0
12 additions, 0 deletions
test/web/activity_pub/activity_pub_test.exs
with
18 additions
and
0 deletions
lib/pleroma/web/activity_pub/activity_pub.ex
+
6
−
0
View file @
866a2663
...
...
@@ -60,4 +60,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
Repo
.
all
(
query
)
|>
Enum
.
reverse
end
def
fetch_activities_for_context
(
context
)
do
query
=
from
activity
in
Activity
,
where:
fragment
(
"? @> ?"
,
activity
.
data
,
^
%{
context:
context
})
Repo
.
all
(
query
)
end
end
This diff is collapsed.
Click to expand it.
test/web/activity_pub/activity_pub_test.exs
+
12
−
0
View file @
866a2663
...
...
@@ -49,6 +49,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
end
end
describe
"fetch activities in context"
do
test
"retrieves activities that have a given context"
do
{
:ok
,
activity
}
=
ActivityBuilder
.
insert
(%{
"context"
=>
"2hu"
})
{
:ok
,
activity_two
}
=
ActivityBuilder
.
insert
(%{
"context"
=>
"2hu"
})
{
:ok
,
_activity_three
}
=
ActivityBuilder
.
insert
(%{
"context"
=>
"3hu"
})
activities
=
ActivityPub
.
fetch_activities_for_context
(
"2hu"
)
assert
activities
==
[
activity
,
activity_two
]
end
end
describe
"public fetch activities"
do
test
"retrieves public activities"
do
%{
public:
public
}
=
ActivityBuilder
.
public_and_non_public
...
...
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