Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pleroma/pleroma-fe
  • eal/pleroma-fe
  • peterspark/pleroma-fe
  • hb2k8/pleroma-fe
  • tibike/pleroma-fe
  • obrez/pleroma-fe
  • partial/pleroma-fe
  • href/pleroma-fe
  • hakabahitoyo/pleroma-fe
  • hsgw/pleroma-fe
  • Azurolu/pleroma-fe
  • cobalto/pleroma-fe
  • qwexvf/pleroma-fe
  • boner.engineer/pleroma-fe
  • f0x/pleroma-fe
  • ataalik/pleroma-fe
  • normandy/pleroma-fe
  • Sir_Boops/pleroma-fe
  • morguldir/pleroma-fe
  • csaurus/pleroma-fe
  • kaniini/pleroma-fe
  • bhtooefr/pleroma-fe
  • andarna/pleroma-fe
  • ktsukik/pleroma-fe
  • Steph/pleroma-fe
  • andrewzah/pleroma-fe
  • lanodan/pleroma-fe
  • pea/pleroma-fe
  • fotfd/pleroma-fe
  • pizzaiolo/pleroma-fe
  • Syldexia/pleroma-fe
  • riking/pleroma-fe
  • dr1ft/pleroma-fe
  • animeirl/pleroma-fe
  • elomatreb/pleroma-fe
  • viv/pleroma-fe
  • goofy/pleroma-fe
  • hoodie/pleroma-fe
  • stolas/pleroma-fe
  • peterpan/pleroma-fe
  • Lumitas/pleroma-fe
  • Toromino/pleroma-fe
  • galen/pleroma-fe
  • scarlett/pleroma-fe
  • ButterflyOfFire/pleroma-fe
  • vaartis/pleroma-fe
  • meireikei/pleroma-fe
  • darko/pleroma-fe
  • pony/pleroma-fe
  • succfemboi/pleroma-fe
  • fadelkon/pleroma-fe
  • dgold/pleroma-fe
  • nebula_moe/pleroma-fe
  • vinzv/pleroma-fe
  • slice/pleroma-fe
  • rinpatch/pleroma-fe
  • maxf/pleroma-fe
  • raeno/pleroma-fe
  • oceanvald/pleroma-fe
  • nuklearfiziks/pleroma-fe
  • feld/pleroma-fe
  • minibikini/pleroma-fe
  • link0ff/pleroma-fe
  • qadeer/pleroma-fe
  • FloatingGhost/pleroma-fe
  • cascode/pleroma-fe
  • hikaruaikawa/pleroma-fe
  • kjwon15/pleroma-fe
  • ukrop/pleroma-fe
  • ilja/pleroma-fe
  • shadowfacts/pleroma-fe
  • edijs/pleroma-fe
  • jdorman632/pleroma-fe
  • xruselfmadex/pleroma-fe
  • futureweb/pleroma-fe
  • eugenijm/pleroma-fe
  • tae/pleroma-fe
  • Dave/pleroma-fe
  • jasper/pleroma-fe
  • Lidar/pleroma-fe
  • parallel588/pleroma-fe
  • jaredr/pleroma-fe
  • rondnelly/pleroma-fe
  • Aditoo/pleroma-fe
  • FongWan/pleroma-fe
  • mkljczk/pleroma-fe
  • nik/pleroma-fe
  • brendenbice1222/pleroma-fe
  • Satak/pleroma-fe
  • xse/pleroma-fe
  • moonman/pleroma-fe
  • Artik/pleroma-fe
  • ssuprunenko/pleroma-fe
  • uncletrunks/pleroma-fe
  • absturztaube/pleroma-fe
  • wyatt777/pleroma-fe
  • hauvophuoc/pleroma-fe
  • dashie/pleroma-fe
  • shmibs/pleroma-fe
  • Elepow/pleroma-fe
  • raven/pleroma-fe
  • buoyantair/pleroma-fe
  • Exilat_a_Tolosa/pleroma-fe
  • matrixsasuke/pleroma-fe
  • njoseph/pleroma-fe
  • ELR/pleroma-fe
  • sjw/pleroma-fe
  • davidyin/pleroma-fe
  • pescetarian/pleroma-fe
  • kphrx/pleroma-fe
  • mewmew/pleroma-fe
  • h3poteto/pleroma-fe
  • Alexpono/pleroma-fe
  • seven/pleroma-fe
  • mparvin/pleroma-fe
  • tuxcrafting/pleroma-fe
  • nekojanai/pleroma-fe
  • xenofem/pleroma-fe
  • p/pleroma-fe
  • creme/pleroma-fe
  • jp/pleroma-fe
  • Jeder/pleroma-fe
  • gensogrips/pleroma-fe
  • caskd/pleroma-fe
  • arkSong/pleroma-fe
  • Hikali/pleroma-fe
  • Duponin/pleroma-fe
  • gashapwn/pleroma-fe
  • fence/pleroma-fe
  • Duder-onomy/pleroma-fe
  • translate/pleroma-fe
  • okl/pleroma-fe
  • bird/pleroma-fe
  • NEETzsche/pleroma-fe
  • Ewoke19CMR/pleroma-fe
  • shevek/pleroma-fe
  • cutienautica/pleroma-fe
  • Nakaya/pleroma-fe
  • Snow/pleroma-fe
  • seanking/pleroma-fe
  • kkcake/pleroma-fe
  • Testacc/pleroma-fe
  • flxy/pleroma-fe
  • xerz/pleroma-fe
  • maronu/pleroma-fe
  • matildepark/pleroma-fe
  • Craftplacer/pleroma-fe
147 results
Show changes
Commits on Source (2)
......@@ -35,15 +35,13 @@ const userSearch = {
},
search (query) {
if (!query) {
this.users = []
return
}
this.loading = true
this.userIds = []
this.$store.dispatch('searchUsers', query)
.then((res) => {
this.loading = false
this.userIds = map(res, 'id')
})
.then((res) => { this.userIds = map(res, 'id') })
.finally(() => { this.loading = false })
}
}
}
......
......@@ -17,7 +17,6 @@ import Autosuggest from '../autosuggest/autosuggest.vue'
import Importer from '../importer/importer.vue'
import Exporter from '../exporter/exporter.vue'
import withSubscription from '../../hocs/with_subscription/with_subscription'
import userSearchApi from '../../services/new_api/user_search.js'
import Mfa from './mfa.vue'
const BlockList = withSubscription({
......@@ -322,11 +321,8 @@ const UserSettings = {
})
},
queryUserIds (query) {
return userSearchApi.search({ query, store: this.$store })
.then((users) => {
this.$store.dispatch('addNewUsers', users)
return map(users, 'id')
})
return this.$store.dispatch('searchUsers', query)
.then((users) => map(users, 'id'))
},
blockUsers (ids) {
return this.$store.dispatch('blockUsers', ids)
......
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
import userSearchApi from '../services/new_api/user_search.js'
import oauthApi from '../services/new_api/oauth.js'
import { compact, map, each, merge, last, concat, uniq } from 'lodash'
import { set } from 'vue'
......@@ -356,14 +355,7 @@ const users = {
})
},
searchUsers (store, query) {
// TODO: Move userSearch api into api.service
return userSearchApi.search({
query,
store: {
state: store.rootState,
getters: store.rootGetters
}
})
return store.rootState.api.backendInteractor.searchUsers(query)
.then((users) => {
store.commit('addNewUsers', users)
return users
......
......@@ -65,6 +65,7 @@ const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials'
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_USER_SEARCH_URL = '/api/v1/accounts/search'
const oldfetch = window.fetch
......@@ -76,7 +77,7 @@ let fetch = (url, options) => {
return oldfetch(fullUrl, options)
}
const promisedRequest = ({ method, url, payload, credentials, headers = {} }) => {
const promisedRequest = ({ method, url, params, payload, credentials, headers = {} }) => {
const options = {
method,
headers: {
......@@ -85,6 +86,11 @@ const promisedRequest = ({ method, url, payload, credentials, headers = {} }) =>
...headers
}
}
if (params) {
url += '?' + Object.entries(params)
.map(([key, value]) => encodeURIComponent(key) + '=' + encodeURIComponent(value))
.join('&')
}
if (payload) {
options.body = JSON.stringify(payload)
}
......@@ -837,6 +843,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 apiService = {
verifyCredentials,
fetchTimeline,
......@@ -899,7 +917,8 @@ const apiService = {
fetchFavoritedByUsers,
fetchRebloggedByUsers,
reportUser,
updateNotificationSettings
updateNotificationSettings,
searchUsers
}
export default apiService
......@@ -147,6 +147,8 @@ const backendInteractorService = credentials => {
const retweet = (id) => apiService.retweet({ id, credentials })
const unretweet = (id) => apiService.unretweet({ id, credentials })
const searchUsers = (query) => apiService.searchUsers({ query, credentials })
const backendInteractorServiceInstance = {
fetchStatus,
fetchConversation,
......@@ -205,7 +207,8 @@ const backendInteractorService = credentials => {
unfavorite,
retweet,
unretweet,
updateNotificationSettings
updateNotificationSettings,
searchUsers
}
return backendInteractorServiceInstance
......
import utils from './utils.js'
import { parseUser } from '../entity_normalizer/entity_normalizer.service.js'
const search = ({ query, store }) => {
return utils.request({
store,
url: '/api/v1/accounts/search',
params: {
q: query,
resolve: true
}
})
.then((data) => data.json())
.then((data) => data.map(parseUser))
}
const UserSearch = {
search
}
export default UserSearch
const queryParams = (params) => {
return Object.keys(params)
.map(k => encodeURIComponent(k) + '=' + encodeURIComponent(params[k]))
.join('&')
}
const headers = (store) => {
const accessToken = store.getters.getToken()
if (accessToken) {
return { 'Authorization': `Bearer ${accessToken}` }
} else {
return {}
}
}
const request = ({ method = 'GET', url, params, store }) => {
const instance = store.state.instance.server
let fullUrl = `${instance}${url}`
if (method === 'GET' && params) {
fullUrl = fullUrl + `?${queryParams(params)}`
}
return window.fetch(fullUrl, {
method,
headers: headers(store),
credentials: 'same-origin'
})
}
const utils = {
queryParams,
request
}
export default utils