switch to mastoapi
This commit is contained in:
parent
379e33f6a5
commit
8702d23a13
@ -197,8 +197,8 @@ const users = {
|
|||||||
},
|
},
|
||||||
blockUser (store, userId) {
|
blockUser (store, userId) {
|
||||||
return store.rootState.api.backendInteractor.blockUser(userId)
|
return store.rootState.api.backendInteractor.blockUser(userId)
|
||||||
.then((blockedUser) => {
|
.then((relationship) => {
|
||||||
store.commit('addNewUsers', [blockedUser])
|
store.commit('updateUserRelationship', [relationship])
|
||||||
store.commit('removeStatus', { timeline: 'friends', userId })
|
store.commit('removeStatus', { timeline: 'friends', userId })
|
||||||
store.commit('removeStatus', { timeline: 'public', userId })
|
store.commit('removeStatus', { timeline: 'public', userId })
|
||||||
store.commit('removeStatus', { timeline: 'publicAndExternal', userId })
|
store.commit('removeStatus', { timeline: 'publicAndExternal', userId })
|
||||||
@ -206,7 +206,7 @@ const users = {
|
|||||||
},
|
},
|
||||||
unblockUser (store, id) {
|
unblockUser (store, id) {
|
||||||
return store.rootState.api.backendInteractor.unblockUser(id)
|
return store.rootState.api.backendInteractor.unblockUser(id)
|
||||||
.then((user) => store.commit('addNewUsers', [user]))
|
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
||||||
},
|
},
|
||||||
fetchMutes (store) {
|
fetchMutes (store) {
|
||||||
return store.rootState.api.backendInteractor.fetchMutes()
|
return store.rootState.api.backendInteractor.fetchMutes()
|
||||||
|
@ -30,8 +30,6 @@ const PROFILE_UPDATE_URL = '/api/account/update_profile.json'
|
|||||||
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
|
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
|
||||||
const QVITTER_USER_NOTIFICATIONS_URL = '/api/qvitter/statuses/notifications.json'
|
const QVITTER_USER_NOTIFICATIONS_URL = '/api/qvitter/statuses/notifications.json'
|
||||||
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
||||||
const BLOCKING_URL = '/api/blocks/create.json'
|
|
||||||
const UNBLOCKING_URL = '/api/blocks/destroy.json'
|
|
||||||
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
||||||
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
||||||
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
||||||
@ -46,6 +44,8 @@ const MASTODON_USER_RELATIONSHIPS_URL = '/api/v1/accounts/relationships'
|
|||||||
const MASTODON_USER_TIMELINE_URL = id => `/api/v1/accounts/${id}/statuses`
|
const MASTODON_USER_TIMELINE_URL = id => `/api/v1/accounts/${id}/statuses`
|
||||||
const MASTODON_USER_BLOCKS_URL = '/api/v1/blocks/'
|
const MASTODON_USER_BLOCKS_URL = '/api/v1/blocks/'
|
||||||
const MASTODON_USER_MUTES_URL = '/api/v1/mutes/'
|
const MASTODON_USER_MUTES_URL = '/api/v1/mutes/'
|
||||||
|
const MASTODON_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block`
|
||||||
|
const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
||||||
|
|
||||||
import { each, map } from 'lodash'
|
import { each, map } from 'lodash'
|
||||||
import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js'
|
import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js'
|
||||||
@ -228,16 +228,14 @@ const unfollowUser = ({id, credentials}) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const blockUser = ({id, credentials}) => {
|
const blockUser = ({id, credentials}) => {
|
||||||
let url = `${BLOCKING_URL}?user_id=${id}`
|
return fetch(MASTODON_BLOCK_USER_URL(id), {
|
||||||
return fetch(url, {
|
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
const unblockUser = ({id, credentials}) => {
|
const unblockUser = ({id, credentials}) => {
|
||||||
let url = `${UNBLOCKING_URL}?user_id=${id}`
|
return fetch(MASTODON_UNBLOCK_USER_URL(id), {
|
||||||
return fetch(url, {
|
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
|
Loading…
Reference in New Issue
Block a user