fix issues caused by merges in usersearch on @

This commit is contained in:
shpuld 2019-07-18 17:22:51 +03:00
parent 029dc7405e
commit 619608ea7a
5 changed files with 19 additions and 3 deletions

View file

@ -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_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin`
const MASTODON_SEARCH_2 = `/api/v2/search`
const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search'
const oldfetch = window.fetch
@ -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 }) => {
let url = MASTODON_SEARCH_2
let params = []
@ -960,7 +973,8 @@ const apiService = {
fetchRebloggedByUsers,
reportUser,
updateNotificationSettings,
search2
search2,
searchUsers
}
export default apiService