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
2dcc6037
Commit
2dcc6037
authored
Apr 01, 2018
by
kaniini
Browse files
mastodon search api: implement a reasonable hashtags stub
parent
5fa8237b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
2dcc6037
...
...
@@ -513,12 +513,16 @@ def search(%{assigns: %{user: user}} = conn, %{"q" => query} = params) do
)
statuses
=
Repo
.
all
(
q
)
++
fetched
tags
=
String
.
split
(
query
)
|>
Enum
.
uniq
()
|>
Enum
.
filter
(
fn
tag
->
String
.
starts_with?
(
tag
,
"#"
)
end
)
|>
Enum
.
map
(
fn
tag
->
String
.
slice
(
tag
,
1
..-
1
)
end
)
res
=
%{
"accounts"
=>
AccountView
.
render
(
"accounts.json"
,
users:
accounts
,
for:
user
,
as:
:user
),
"statuses"
=>
StatusView
.
render
(
"index.json"
,
activities:
statuses
,
for:
user
,
as:
:activity
),
"hashtags"
=>
[]
"hashtags"
=>
tags
}
json
(
conn
,
res
)
...
...
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