Commit 619608ea authored by Shpuld Shpludson's avatar Shpuld Shpludson

fix issues caused by merges in usersearch on @

parent 029dc740
...@@ -13,7 +13,7 @@ import { debounce } from 'lodash' ...@@ -13,7 +13,7 @@ import { debounce } from 'lodash'
const debounceUserSearch = debounce((data, input) => { const debounceUserSearch = debounce((data, input) => {
data.updateUsersList(input) data.updateUsersList(input)
}, 500, {leading: true, trailing: false}) }, 500, { leading: true, trailing: false })
export default data => input => { export default data => input => {
const firstChar = input[0] const firstChar = input[0]
......
...@@ -68,6 +68,7 @@ const MASTODON_REPORT_USER_URL = '/api/v1/reports' ...@@ -68,6 +68,7 @@ const MASTODON_REPORT_USER_URL = '/api/v1/reports'
const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin` const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin`
const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin` const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin`
const MASTODON_SEARCH_2 = `/api/v2/search` const MASTODON_SEARCH_2 = `/api/v2/search`
const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search'
const oldfetch = window.fetch const oldfetch = window.fetch
...@@ -853,6 +854,18 @@ const reportUser = ({ credentials, userId, statusIds, comment, forward }) => { ...@@ -853,6 +854,18 @@ const reportUser = ({ credentials, userId, statusIds, comment, forward }) => {
}) })
} }
const searchUsers = ({ credentials, query }) => {
return promisedRequest({
url: MASTODON_USER_SEARCH_URL,
params: {
q: query,
resolve: true
},
credentials
})
.then((data) => data.map(parseUser))
}
const search2 = ({ credentials, q, resolve, limit, offset, following }) => { const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
let url = MASTODON_SEARCH_2 let url = MASTODON_SEARCH_2
let params = [] let params = []
...@@ -960,7 +973,8 @@ const apiService = { ...@@ -960,7 +973,8 @@ const apiService = {
fetchRebloggedByUsers, fetchRebloggedByUsers,
reportUser, reportUser,
updateNotificationSettings, updateNotificationSettings,
search2 search2,
searchUsers
} }
export default apiService export default apiService
...@@ -150,6 +150,7 @@ const backendInteractorService = credentials => { ...@@ -150,6 +150,7 @@ const backendInteractorService = credentials => {
const unretweet = (id) => apiService.unretweet({ id, credentials }) const unretweet = (id) => apiService.unretweet({ id, credentials })
const search2 = ({ q, resolve, limit, offset, following }) => const search2 = ({ q, resolve, limit, offset, following }) =>
apiService.search2({ credentials, q, resolve, limit, offset, following }) apiService.search2({ credentials, q, resolve, limit, offset, following })
const searchUsers = (query) => apiService.searchUsers({ query, credentials })
const backendInteractorServiceInstance = { const backendInteractorServiceInstance = {
fetchStatus, fetchStatus,
...@@ -212,7 +213,8 @@ const backendInteractorService = credentials => { ...@@ -212,7 +213,8 @@ const backendInteractorService = credentials => {
retweet, retweet,
unretweet, unretweet,
updateNotificationSettings, updateNotificationSettings,
search2 search2,
searchUsers
} }
return backendInteractorServiceInstance return backendInteractorServiceInstance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment