Skip to content
GitLab
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
632e1f79
Commit
632e1f79
authored
Sep 04, 2017
by
lain
Browse files
Add delete to TwAPI representer correctly.
parent
1f9a5272
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/twitter_api/representers/activity_representer.ex
View file @
632e1f79
...
...
@@ -100,7 +100,8 @@ def to_map(%Activity{data: %{"type" => "Delete", "published" => created_at, "obj
created_at
=
created_at
|>
Utils
.
date_to_asctime
%{
"id"
=>
activity
.
data
[
"object"
],
"id"
=>
activity
.
id
,
"uri"
=>
activity
.
data
[
"object"
],
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"attentions"
=>
[],
"statusnet_html"
=>
"deleted notice {{tag"
,
...
...
@@ -135,6 +136,7 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac
%{
"id"
=>
activity
.
id
,
"uri"
=>
activity
.
data
[
"object"
][
"id"
],
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"statusnet_html"
=>
HtmlSanitizeEx
.
basic_html
(
content
)
|>
Formatter
.
finmojifiy
,
"text"
=>
HtmlSanitizeEx
.
strip_tags
(
content
),
...
...
lib/pleroma/web/twitter_api/twitter_api.ex
View file @
632e1f79
...
...
@@ -265,6 +265,12 @@ defp activity_to_status(%Activity{data: %{"type" => "Announce"}} = activity, opt
ActivityRepresenter
.
to_map
(
activity
,
Map
.
merge
(
opts
,
%{
users:
[
user
,
announced_actor
],
announced_activity:
announced_activity
}))
end
defp
activity_to_status
(%
Activity
{
data:
%{
"type"
=>
"Delete"
}}
=
activity
,
opts
)
do
actor
=
get_in
(
activity
.
data
,
[
"actor"
])
user
=
User
.
get_cached_by_ap_id
(
actor
)
ActivityRepresenter
.
to_map
(
activity
,
Map
.
merge
(
opts
,
%{
user:
user
}))
end
defp
activity_to_status
(
activity
,
opts
)
do
actor
=
get_in
(
activity
.
data
,
[
"actor"
])
user
=
User
.
get_cached_by_ap_id
(
actor
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment