From 8e399710988dd874bd921a9ced76daf90034c29f Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 13 May 2020 17:48:31 +0300 Subject: [PATCH] add with_relationships where necessary --- src/components/post_status_form/post_status_form.js | 2 +- src/components/user_settings/user_settings.js | 4 ++-- src/modules/users.js | 4 ++-- src/services/api/api.service.js | 13 +++++++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 74067fef..a98e1e31 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -102,7 +102,7 @@ const PostStatusForm = { ...this.$store.state.instance.customEmoji ], users: this.$store.state.users.users, - updateUsersList: (input) => this.$store.dispatch('searchUsers', input) + updateUsersList: (query) => this.$store.dispatch('searchUsers', { query }) }) }, emojiSuggestor () { diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 5338c974..a1ec2997 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -112,7 +112,7 @@ const UserSettings = { ...this.$store.state.instance.customEmoji ], users: this.$store.state.users.users, - updateUsersList: (input) => this.$store.dispatch('searchUsers', input) + updateUsersList: (query) => this.$store.dispatch('searchUsers', { query }) }) }, emojiSuggestor () { @@ -362,7 +362,7 @@ const UserSettings = { }) }, queryUserIds (query) { - return this.$store.dispatch('searchUsers', query) + return this.$store.dispatch('searchUsers', { query }) .then((users) => map(users, 'id')) }, blockUsers (ids) { diff --git a/src/modules/users.js b/src/modules/users.js index 1d1b415c..f377da75 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -428,8 +428,8 @@ const users = { store.commit('setUserForNotification', notification) }) }, - searchUsers (store, query) { - return store.rootState.api.backendInteractor.searchUsers({ query }) + searchUsers (store, { query, withRelationships }) { + return store.rootState.api.backendInteractor.searchUsers({ query, withRelationships }) .then((users) => { store.commit('addNewUsers', users) return users diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 72c8874f..94ff4623 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -324,7 +324,8 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => { const args = [ maxId && `max_id=${maxId}`, sinceId && `since_id=${sinceId}`, - limit && `limit=${limit}` + limit && `limit=${limit}`, + `with_relationships=true` ].filter(_ => _).join('&') url = url + (args ? '?' + args : '') @@ -358,7 +359,8 @@ const fetchFollowers = ({ id, maxId, sinceId, limit = 20, credentials }) => { const args = [ maxId && `max_id=${maxId}`, sinceId && `since_id=${sinceId}`, - limit && `limit=${limit}` + limit && `limit=${limit}`, + `with_relationships=true` ].filter(_ => _).join('&') 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({ url: MASTODON_USER_SEARCH_URL, params: { q: query, - resolve: true + resolve: true, + with_relationships: withRelationships }, credentials }) @@ -971,6 +974,8 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => { params.push(['following', true]) } + params.push(['with_relationships', true]) + let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') url += `?${queryString}`