Use /api/v1/accounts/:id/follow for account subscriptions instead of the deprecated routes
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
83189d9d41
commit
d67d24757f
1
changelog.d/deprecate-subscribe.change
Normal file
1
changelog.d/deprecate-subscribe.change
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Use /api/v1/accounts/:id/follow for account subscriptions instead of the deprecated routes
|
|
@ -208,7 +208,7 @@
|
||||||
/>
|
/>
|
||||||
<template v-if="relationship.following">
|
<template v-if="relationship.following">
|
||||||
<ProgressButton
|
<ProgressButton
|
||||||
v-if="!relationship.subscribing"
|
v-if="!relationship.notifying"
|
||||||
class="btn button-default"
|
class="btn button-default"
|
||||||
:click="subscribeUser"
|
:click="subscribeUser"
|
||||||
:title="$t('user_card.subscribe')"
|
:title="$t('user_card.subscribe')"
|
||||||
|
|
|
@ -452,11 +452,11 @@ const users = {
|
||||||
commit('clearFollowers', userId)
|
commit('clearFollowers', userId)
|
||||||
},
|
},
|
||||||
subscribeUser ({ rootState, commit }, id) {
|
subscribeUser ({ rootState, commit }, id) {
|
||||||
return rootState.api.backendInteractor.subscribeUser({ id })
|
return rootState.api.backendInteractor.followUser({ id, notify: true })
|
||||||
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
||||||
},
|
},
|
||||||
unsubscribeUser ({ rootState, commit }, id) {
|
unsubscribeUser ({ rootState, commit }, id) {
|
||||||
return rootState.api.backendInteractor.unsubscribeUser({ id })
|
return rootState.api.backendInteractor.followUser({ id, notify: false })
|
||||||
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
.then((relationship) => commit('updateUserRelationship', [relationship]))
|
||||||
},
|
},
|
||||||
toggleActivationStatus ({ rootState, commit }, { user }) {
|
toggleActivationStatus ({ rootState, commit }, { user }) {
|
||||||
|
|
|
@ -68,8 +68,6 @@ const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
||||||
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
||||||
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
||||||
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
|
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
|
||||||
const MASTODON_SUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/subscribe`
|
|
||||||
const MASTODON_UNSUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/unsubscribe`
|
|
||||||
const MASTODON_USER_NOTE_URL = id => `/api/v1/accounts/${id}/note`
|
const MASTODON_USER_NOTE_URL = id => `/api/v1/accounts/${id}/note`
|
||||||
const MASTODON_BOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/bookmark`
|
const MASTODON_BOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/bookmark`
|
||||||
const MASTODON_UNBOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/unbookmark`
|
const MASTODON_UNBOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/unbookmark`
|
||||||
|
@ -273,6 +271,7 @@ const followUser = ({ id, credentials, ...options }) => {
|
||||||
const url = MASTODON_FOLLOW_URL(id)
|
const url = MASTODON_FOLLOW_URL(id)
|
||||||
const form = {}
|
const form = {}
|
||||||
if (options.reblogs !== undefined) { form.reblogs = options.reblogs }
|
if (options.reblogs !== undefined) { form.reblogs = options.reblogs }
|
||||||
|
if (options.notify !== undefined) { form.notify = options.notify }
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1171,14 +1170,6 @@ const unmuteUser = ({ id, credentials }) => {
|
||||||
return promisedRequest({ url: MASTODON_UNMUTE_USER_URL(id), credentials, method: 'POST' })
|
return promisedRequest({ url: MASTODON_UNMUTE_USER_URL(id), credentials, method: 'POST' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const subscribeUser = ({ id, credentials }) => {
|
|
||||||
return promisedRequest({ url: MASTODON_SUBSCRIBE_USER(id), credentials, method: 'POST' })
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsubscribeUser = ({ id, credentials }) => {
|
|
||||||
return promisedRequest({ url: MASTODON_UNSUBSCRIBE_USER(id), credentials, method: 'POST' })
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchBlocks = ({ maxId, credentials }) => {
|
const fetchBlocks = ({ maxId, credentials }) => {
|
||||||
const query = new URLSearchParams({ with_relationships: true })
|
const query = new URLSearchParams({ with_relationships: true })
|
||||||
if (maxId) {
|
if (maxId) {
|
||||||
|
@ -1931,8 +1922,6 @@ const apiService = {
|
||||||
fetchMutes,
|
fetchMutes,
|
||||||
muteUser,
|
muteUser,
|
||||||
unmuteUser,
|
unmuteUser,
|
||||||
subscribeUser,
|
|
||||||
unsubscribeUser,
|
|
||||||
fetchBlocks,
|
fetchBlocks,
|
||||||
fetchOAuthTokens,
|
fetchOAuthTokens,
|
||||||
revokeOAuthToken,
|
revokeOAuthToken,
|
||||||
|
|
Loading…
Reference in a new issue