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
1c074efe
Commit
1c074efe
authored
Jun 25, 2017
by
lain
Browse files
Add external links to twapi.
parent
429992fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/twitter_api/representers/activity_representer.ex
View file @
1c074efe
...
...
@@ -23,7 +23,7 @@ def to_map(%Activity{data: %{"type" => "Announce", "actor" => actor, "published"
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"statusnet_html"
=>
text
,
"text"
=>
text
,
"is_local"
=>
true
,
"is_local"
=>
activity
.
local
,
"is_post_verb"
=>
false
,
"uri"
=>
"tag:
#{
activity
.
data
[
"id"
]
}
:objectType=note"
,
"created_at"
=>
created_at
,
...
...
@@ -44,7 +44,7 @@ def to_map(%Activity{data: %{"type" => "Like", "published" => created_at}} = act
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"statusnet_html"
=>
text
,
"text"
=>
text
,
"is_local"
=>
true
,
"is_local"
=>
activity
.
local
,
"is_post_verb"
=>
false
,
"uri"
=>
"tag:
#{
activity
.
data
[
"id"
]
}
:objectType=Favourite"
,
"created_at"
=>
created_at
,
...
...
@@ -64,7 +64,7 @@ def to_map(%Activity{data: %{"type" => "Follow", "published" => created_at, "obj
"attentions"
=>
[],
"statusnet_html"
=>
text
,
"text"
=>
text
,
"is_local"
=>
true
,
"is_local"
=>
activity
.
local
,
"is_post_verb"
=>
false
,
"created_at"
=>
created_at
,
"in_reply_to_status_id"
=>
nil
,
...
...
@@ -93,7 +93,7 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"statusnet_html"
=>
HtmlSanitizeEx
.
basic_html
(
content
)
|>
Formatter
.
finmojifiy
,
"text"
=>
HtmlSanitizeEx
.
strip_tags
(
content
),
"is_local"
=>
true
,
"is_local"
=>
activity
.
local
,
"is_post_verb"
=>
true
,
"created_at"
=>
created_at
,
"in_reply_to_status_id"
=>
object
[
"inReplyToStatusId"
],
...
...
@@ -104,7 +104,7 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac
"repeat_num"
=>
announcement_count
,
"favorited"
=>
to_boolean
(
favorited
),
"repeated"
=>
to_boolean
(
repeated
),
"external_url"
=>
activity
.
data
[
"id
"
],
"external_url"
=>
object
[
"external_url
"
],
"tags"
=>
activity
.
data
[
"object"
][
"tag"
]
||
[]
}
end
...
...
test/web/twitter_api/representers/activity_representer_test.exs
View file @
1c074efe
...
...
@@ -93,6 +93,7 @@ test "an activity" do
"attachment"
=>
[
object
],
"external_url"
=>
"some url"
,
"like_count"
=>
5
,
"announcement_count"
=>
3
,
"context"
=>
"2hu"
,
...
...
@@ -100,14 +101,15 @@ test "an activity" do
},
"published"
=>
date
,
"context"
=>
"2hu"
}
},
local:
false
}
expected_status
=
%{
"id"
=>
activity
.
id
,
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
follower
}),
"is_local"
=>
tru
e
,
"is_local"
=>
fals
e
,
"statusnet_html"
=>
HtmlSanitizeEx
.
basic_html
(
content_html
),
"text"
=>
content
,
"is_post_verb"
=>
true
,
...
...
@@ -124,7 +126,7 @@ test "an activity" do
"repeat_num"
=>
3
,
"favorited"
=>
false
,
"repeated"
=>
false
,
"external_url"
=>
activity
.
data
[
"id"
]
,
"external_url"
=>
"some url"
,
"tags"
=>
[
"content"
,
"mentioning"
,
"nsfw"
]
}
...
...
Write
Preview
Markdown
is supported
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