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
f1f79c0d
Commit
f1f79c0d
authored
Dec 19, 2017
by
lain
Browse files
Fix timelines in subway tooter.
parent
47887ac8
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/formatter.ex
View file @
f1f79c0d
...
...
@@ -10,7 +10,7 @@ def linkify(text) do
def
parse_tags
(
text
,
data
\\
%{})
do
Regex
.
scan
(
@tag_regex
,
text
)
|>
Enum
.
map
(
fn
([
"#"
<>
tag
=
full_tag
])
->
{
full_tag
,
String
.
downcase
(
tag
)}
end
)
|>
(
fn
map
->
if
data
[
"sensitive"
]
in
[
true
,
"True"
,
"true"
],
do
:
[{
"#nsfw"
,
"nsfw"
}]
++
map
,
else
:
map
end
)
.
()
|>
(
fn
map
->
if
data
[
"sensitive"
]
in
[
true
,
"True"
,
"true"
,
"1"
],
do
:
[{
"#nsfw"
,
"nsfw"
}]
++
map
,
else
:
map
end
)
.
()
end
def
parse_mentions
(
text
)
do
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
f1f79c0d
...
...
@@ -162,7 +162,7 @@ def home_timeline(%{assigns: %{user: user}} = conn, params) do
def
public_timeline
(%{
assigns:
%{
user:
user
}}
=
conn
,
params
)
do
params
=
params
|>
Map
.
put
(
"type"
,
[
"Create"
,
"Announce"
])
|>
Map
.
put
(
"local_only"
,
params
[
"local"
]
in
[
true
,
"True"
,
"true"
])
|>
Map
.
put
(
"local_only"
,
params
[
"local"
]
in
[
true
,
"True"
,
"true"
,
"1"
])
|>
Map
.
put
(
"blocking_user"
,
user
)
activities
=
ActivityPub
.
fetch_public_activities
(
params
)
...
...
test/web/mastodon_api/mastodon_api_controller_test.exs
View file @
f1f79c0d
...
...
@@ -43,6 +43,11 @@ test "the public timeline", %{conn: conn} do
|>
get
(
"/api/v1/timelines/public"
,
%{
"local"
=>
"True"
})
assert
[%{
"content"
=>
"test"
}]
=
json_response
(
conn
,
200
)
conn
=
build_conn
()
|>
get
(
"/api/v1/timelines/public"
,
%{
"local"
=>
"1"
})
assert
[%{
"content"
=>
"test"
}]
=
json_response
(
conn
,
200
)
end
test
"posting a status"
,
%{
conn:
conn
}
do
...
...
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