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
jeff
pleroma
Commits
ebbe11f3
Commit
ebbe11f3
authored
6 years ago
by
lain
Browse files
Options
Downloads
Plain Diff
Merge branch 'support/issue_449' into 'develop'
[#449] fix text field See merge request
pleroma/pleroma!563
parents
52ac7dce
92a5133c
Branches
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
-1
6 additions, 1 deletion
lib/pleroma/web/twitter_api/views/activity_view.ex
test/web/twitter_api/views/activity_view_test.exs
+16
-0
16 additions, 0 deletions
test/web/twitter_api/views/activity_view_test.exs
with
22 additions
and
1 deletion
lib/pleroma/web/twitter_api/views/activity_view.ex
+
6
−
1
View file @
ebbe11f3
...
...
@@ -244,6 +244,11 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|>
HTML
.
filter_tags
(
User
.
html_filter_policy
(
opts
[
:for
]))
|>
Formatter
.
emojify
(
object
[
"emoji"
])
text
=
content
|>
String
.
replace
(
~r/<br\s?\/
?>
/
,
"
\n
"
)
|>
HTML
.
strip_tags
()
reply_parent
=
Activity
.
get_in_reply_to_activity
(
activity
)
reply_user
=
reply_parent
&&
User
.
get_cached_by_ap_id
(
reply_parent
.
actor
)
...
...
@@ -253,7 +258,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
"uri"
=>
activity
.
data
[
"object"
][
"id"
],
"user"
=>
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
opts
[
:for
]}),
"statusnet_html"
=>
html
,
"text"
=>
HTML
.
strip_tags
(
content
)
,
"text"
=>
text
,
"is_local"
=>
activity
.
local
,
"is_post_verb"
=>
true
,
"created_at"
=>
created_at
,
...
...
This diff is collapsed.
Click to expand it.
test/web/twitter_api/views/activity_view_test.exs
+
16
−
0
View file @
ebbe11f3
...
...
@@ -14,6 +14,22 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
import
Pleroma
.
Factory
import
Mock
test
"a create activity with a html status"
do
text
=
"""
#Bike log - Commute Tuesday\nhttps://pla.bike/posts/20181211/\n#cycling #CHScycling #commute\nMVIMG_20181211_054020.jpg
"""
{
:ok
,
activity
}
=
CommonAPI
.
post
(
insert
(
:user
),
%{
"status"
=>
text
})
result
=
ActivityView
.
render
(
"activity.json"
,
activity:
activity
)
assert
result
[
"statusnet_html"
]
==
"<a data-tag=
\"
bike
\"
href=
\"
http://localhost:4001/tag/bike
\"
>#Bike</a> log - Commute Tuesday<br /><a href=
\"
https://pla.bike/posts/20181211/
\"
>https://pla.bike/posts/20181211/</a><br /><a data-tag=
\"
cycling
\"
href=
\"
http://localhost:4001/tag/cycling
\"
>#cycling</a> <a data-tag=
\"
chscycling
\"
href=
\"
http://localhost:4001/tag/chscycling
\"
>#CHScycling</a> <a data-tag=
\"
commute
\"
href=
\"
http://localhost:4001/tag/commute
\"
>#commute</a><br />MVIMG_20181211_054020.jpg"
assert
result
[
"text"
]
==
"#Bike log - Commute Tuesday
\n
https://pla.bike/posts/20181211/
\n
#cycling #CHScycling #commute
\n
MVIMG_20181211_054020.jpg"
end
test
"a create activity with a note"
do
user
=
insert
(
:user
)
other_user
=
insert
(
:user
,
%{
nickname:
"shp"
})
...
...
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