add with_relationships where necessary

This commit is contained in:
Shpuld Shpuldson 2020-05-13 17:48:31 +03:00
parent 7a0e554daf
commit 8e39971098
4 changed files with 14 additions and 9 deletions

View File

@ -102,7 +102,7 @@ const PostStatusForm = {
...this.$store.state.instance.customEmoji ...this.$store.state.instance.customEmoji
], ],
users: this.$store.state.users.users, users: this.$store.state.users.users,
updateUsersList: (input) => this.$store.dispatch('searchUsers', input) updateUsersList: (query) => this.$store.dispatch('searchUsers', { query })
}) })
}, },
emojiSuggestor () { emojiSuggestor () {

View File

@ -112,7 +112,7 @@ const UserSettings = {
...this.$store.state.instance.customEmoji ...this.$store.state.instance.customEmoji
], ],
users: this.$store.state.users.users, users: this.$store.state.users.users,
updateUsersList: (input) => this.$store.dispatch('searchUsers', input) updateUsersList: (query) => this.$store.dispatch('searchUsers', { query })
}) })
}, },
emojiSuggestor () { emojiSuggestor () {
@ -362,7 +362,7 @@ const UserSettings = {
}) })
}, },
queryUserIds (query) { queryUserIds (query) {
return this.$store.dispatch('searchUsers', query) return this.$store.dispatch('searchUsers', { query })
.then((users) => map(users, 'id')) .then((users) => map(users, 'id'))
}, },
blockUsers (ids) { blockUsers (ids) {

View File

@ -428,8 +428,8 @@ const users = {
store.commit('setUserForNotification', notification) store.commit('setUserForNotification', notification)
}) })
}, },
searchUsers (store, query) { searchUsers (store, { query, withRelationships }) {
return store.rootState.api.backendInteractor.searchUsers({ query }) return store.rootState.api.backendInteractor.searchUsers({ query, withRelationships })
.then((users) => { .then((users) => {
store.commit('addNewUsers', users) store.commit('addNewUsers', users)
return users return users

View File

@ -324,7 +324,8 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => {
const args = [ const args = [
maxId && `max_id=${maxId}`, maxId && `max_id=${maxId}`,
sinceId && `since_id=${sinceId}`, sinceId && `since_id=${sinceId}`,
limit && `limit=${limit}` limit && `limit=${limit}`,
`with_relationships=true`
].filter(_ => _).join('&') ].filter(_ => _).join('&')
url = url + (args ? '?' + args : '') url = url + (args ? '?' + args : '')
@ -358,7 +359,8 @@ const fetchFollowers = ({ id, maxId, sinceId, limit = 20, credentials }) => {
const args = [ const args = [
maxId && `max_id=${maxId}`, maxId && `max_id=${maxId}`,
sinceId && `since_id=${sinceId}`, sinceId && `since_id=${sinceId}`,
limit && `limit=${limit}` limit && `limit=${limit}`,
`with_relationships=true`
].filter(_ => _).join('&') ].filter(_ => _).join('&')
url += args ? '?' + args : '' url += args ? '?' + args : ''
@ -935,12 +937,13 @@ const reportUser = ({ credentials, userId, statusIds, comment, forward }) => {
}) })
} }
const searchUsers = ({ credentials, query }) => { const searchUsers = ({ credentials, query, withRelationships }) => {
return promisedRequest({ return promisedRequest({
url: MASTODON_USER_SEARCH_URL, url: MASTODON_USER_SEARCH_URL,
params: { params: {
q: query, q: query,
resolve: true resolve: true,
with_relationships: withRelationships
}, },
credentials credentials
}) })
@ -971,6 +974,8 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
params.push(['following', true]) params.push(['following', true])
} }
params.push(['with_relationships', true])
let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
url += `?${queryString}` url += `?${queryString}`