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
href
pleroma
Commits
61ad2ce4
Commit
61ad2ce4
authored
6 years ago
by
eal
Browse files
Options
Downloads
Patches
Plain Diff
TwitterAPI: Include favorited post in json
parent
b19ee622
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
lib/pleroma/web/twitter_api/views/activity_view.ex
+6
-0
6 additions, 0 deletions
lib/pleroma/web/twitter_api/views/activity_view.ex
test/web/twitter_api/views/activity_view_test.exs
+3
-0
3 additions, 0 deletions
test/web/twitter_api/views/activity_view_test.exs
with
9 additions
and
0 deletions
lib/pleroma/web/twitter_api/views/activity_view.ex
+
6
−
0
View file @
61ad2ce4
...
...
@@ -190,6 +190,11 @@ def render("activity.json", %{activity: %{data: %{"type" => "Like"}} = activity}
text
=
"
#{
user
.
nickname
}
favorited a status."
favorited_status
=
if
liked_activity
,
do
:
render
(
"activity.json"
,
Map
.
merge
(
opts
,
%{
activity:
liked_activity
})),
else
:
nil
%{
"id"
=>
activity
.
id
,
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
...
...
@@ -199,6 +204,7 @@ def render("activity.json", %{activity: %{data: %{"type" => "Like"}} = activity}
"is_post_verb"
=>
false
,
"uri"
=>
"tag:
#{
activity
.
data
[
"id"
]
}
:objectType=Favourite"
,
"created_at"
=>
created_at
,
"favorited_status"
=>
favorited_status
,
"in_reply_to_status_id"
=>
liked_activity_id
,
"external_url"
=>
activity
.
data
[
"id"
],
"activity_type"
=>
"like"
...
...
This diff is collapsed.
Click to expand it.
test/web/twitter_api/views/activity_view_test.exs
+
3
−
0
View file @
61ad2ce4
...
...
@@ -112,6 +112,7 @@ test "a like activity" do
{
:ok
,
like
,
_object
}
=
CommonAPI
.
favorite
(
activity
.
id
,
other_user
)
result
=
ActivityView
.
render
(
"activity.json"
,
activity:
like
)
activity
=
Pleroma
.
Activity
.
get_by_ap_id
(
activity
.
data
[
"id"
])
expected
=
%{
"activity_type"
=>
"like"
,
...
...
@@ -121,6 +122,7 @@ test "a like activity" do
"in_reply_to_status_id"
=>
activity
.
id
,
"is_local"
=>
true
,
"is_post_verb"
=>
false
,
"favorited_status"
=>
ActivityView
.
render
(
"activity.json"
,
activity:
activity
),
"statusnet_html"
=>
"shp favorited a status."
,
"text"
=>
"shp favorited a status."
,
"uri"
=>
"tag:
#{
like
.
data
[
"id"
]
}
:objectType=Favourite"
,
...
...
@@ -148,6 +150,7 @@ test "a like activity for deleted post" do
"in_reply_to_status_id"
=>
nil
,
"is_local"
=>
true
,
"is_post_verb"
=>
false
,
"favorited_status"
=>
nil
,
"statusnet_html"
=>
"shp favorited a status."
,
"text"
=>
"shp favorited a status."
,
"uri"
=>
"tag:
#{
like
.
data
[
"id"
]
}
:objectType=Favourite"
,
...
...
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