forked from AkkomaGang/akkoma-fe
Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma-fe into issue-433-status-reply-form
This commit is contained in:
commit
e24145e233
6 changed files with 96 additions and 70 deletions
|
@ -120,9 +120,9 @@ const conversation = {
|
||||||
this.$store.dispatch('addNewStatuses', { statuses: ancestors })
|
this.$store.dispatch('addNewStatuses', { statuses: ancestors })
|
||||||
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
this.$store.dispatch('addNewStatuses', { statuses: descendants })
|
||||||
set(this, 'converationStatusIds', [].concat(
|
set(this, 'converationStatusIds', [].concat(
|
||||||
ancestors.map(_ => _.id),
|
ancestors.map(_ => _.id).filter(_ => _ !== this.statusId),
|
||||||
this.statusId,
|
this.statusId,
|
||||||
descendants.map(_ => _.id)))
|
descendants.map(_ => _.id).filter(_ => _ !== this.statusId)))
|
||||||
})
|
})
|
||||||
.then(() => this.setHighlight(this.statusId))
|
.then(() => this.setHighlight(this.statusId))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -433,13 +433,6 @@ const statuses = {
|
||||||
// Optimistic favoriting...
|
// Optimistic favoriting...
|
||||||
commit('setFavorited', { status, value: true })
|
commit('setFavorited', { status, value: true })
|
||||||
apiService.favorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
apiService.favorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
||||||
.then(response => {
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json()
|
|
||||||
} else {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(status => {
|
.then(status => {
|
||||||
commit('setFavoritedConfirm', { status })
|
commit('setFavoritedConfirm', { status })
|
||||||
})
|
})
|
||||||
|
@ -448,13 +441,6 @@ const statuses = {
|
||||||
// Optimistic favoriting...
|
// Optimistic favoriting...
|
||||||
commit('setFavorited', { status, value: false })
|
commit('setFavorited', { status, value: false })
|
||||||
apiService.unfavorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
apiService.unfavorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
||||||
.then(response => {
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json()
|
|
||||||
} else {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(status => {
|
.then(status => {
|
||||||
commit('setFavoritedConfirm', { status })
|
commit('setFavoritedConfirm', { status })
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
||||||
import { compact, map, each, merge, find } from 'lodash'
|
import { compact, map, each, merge, find, last } from 'lodash'
|
||||||
import { set } from 'vue'
|
import { set } from 'vue'
|
||||||
import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js'
|
import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js'
|
||||||
import oauthApi from '../services/new_api/oauth'
|
import oauthApi from '../services/new_api/oauth'
|
||||||
|
@ -52,23 +52,23 @@ export const mutations = {
|
||||||
state.loggingIn = false
|
state.loggingIn = false
|
||||||
},
|
},
|
||||||
// TODO Clean after ourselves?
|
// TODO Clean after ourselves?
|
||||||
addFriends (state, { id, friends, page }) {
|
addFriends (state, { id, friends }) {
|
||||||
const user = state.usersObject[id]
|
const user = state.usersObject[id]
|
||||||
each(friends, friend => {
|
each(friends, friend => {
|
||||||
if (!find(user.friends, { id: friend.id })) {
|
if (!find(user.friends, { id: friend.id })) {
|
||||||
user.friends.push(friend)
|
user.friends.push(friend)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
user.friendsPage = page + 1
|
user.lastFriendId = last(friends).id
|
||||||
},
|
},
|
||||||
addFollowers (state, { id, followers, page }) {
|
addFollowers (state, { id, followers }) {
|
||||||
const user = state.usersObject[id]
|
const user = state.usersObject[id]
|
||||||
each(followers, follower => {
|
each(followers, follower => {
|
||||||
if (!find(user.followers, { id: follower.id })) {
|
if (!find(user.followers, { id: follower.id })) {
|
||||||
user.followers.push(follower)
|
user.followers.push(follower)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
user.followersPage = page + 1
|
user.lastFollowerId = last(followers).id
|
||||||
},
|
},
|
||||||
// Because frontend doesn't have a reason to keep these stuff in memory
|
// Because frontend doesn't have a reason to keep these stuff in memory
|
||||||
// outside of viewing someones user profile.
|
// outside of viewing someones user profile.
|
||||||
|
@ -78,7 +78,7 @@ export const mutations = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user.friends = []
|
user.friends = []
|
||||||
user.friendsPage = 0
|
user.lastFriendId = null
|
||||||
},
|
},
|
||||||
clearFollowers (state, userId) {
|
clearFollowers (state, userId) {
|
||||||
const user = state.usersObject[userId]
|
const user = state.usersObject[userId]
|
||||||
|
@ -86,7 +86,7 @@ export const mutations = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user.followers = []
|
user.followers = []
|
||||||
user.followersPage = 0
|
user.lastFollowerId = null
|
||||||
},
|
},
|
||||||
addNewUsers (state, users) {
|
addNewUsers (state, users) {
|
||||||
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
||||||
|
@ -219,10 +219,10 @@ const users = {
|
||||||
addFriends ({ rootState, commit }, fetchBy) {
|
addFriends ({ rootState, commit }, fetchBy) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const user = rootState.users.usersObject[fetchBy]
|
const user = rootState.users.usersObject[fetchBy]
|
||||||
const page = user.friendsPage || 1
|
const maxId = user.lastFriendId
|
||||||
rootState.api.backendInteractor.fetchFriends({ id: user.id, page })
|
rootState.api.backendInteractor.fetchFriends({ id: user.id, maxId })
|
||||||
.then((friends) => {
|
.then((friends) => {
|
||||||
commit('addFriends', { id: user.id, friends, page })
|
commit('addFriends', { id: user.id, friends })
|
||||||
resolve(friends)
|
resolve(friends)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
reject()
|
reject()
|
||||||
|
@ -231,10 +231,10 @@ const users = {
|
||||||
},
|
},
|
||||||
addFollowers ({ rootState, commit }, fetchBy) {
|
addFollowers ({ rootState, commit }, fetchBy) {
|
||||||
const user = rootState.users.usersObject[fetchBy]
|
const user = rootState.users.usersObject[fetchBy]
|
||||||
const page = user.followersPage || 1
|
const maxId = user.lastFollowerId
|
||||||
return rootState.api.backendInteractor.fetchFollowers({ id: user.id, page })
|
return rootState.api.backendInteractor.fetchFollowers({ id: user.id, maxId })
|
||||||
.then((followers) => {
|
.then((followers) => {
|
||||||
commit('addFollowers', { id: user.id, followers, page })
|
commit('addFollowers', { id: user.id, followers })
|
||||||
return followers
|
return followers
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
const LOGIN_URL = '/api/account/verify_credentials.json'
|
const LOGIN_URL = '/api/account/verify_credentials.json'
|
||||||
const FRIENDS_TIMELINE_URL = '/api/statuses/friends_timeline.json'
|
|
||||||
const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing'
|
const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing'
|
||||||
const TAG_TIMELINE_URL = '/api/statusnet/tags/timeline'
|
|
||||||
const FAVORITE_URL = '/api/favorites/create'
|
|
||||||
const UNFAVORITE_URL = '/api/favorites/destroy'
|
|
||||||
const RETWEET_URL = '/api/statuses/retweet'
|
|
||||||
const UNRETWEET_URL = '/api/statuses/unretweet'
|
|
||||||
const STATUS_DELETE_URL = '/api/statuses/destroy'
|
|
||||||
const MENTIONS_URL = '/api/statuses/mentions.json'
|
const MENTIONS_URL = '/api/statuses/mentions.json'
|
||||||
const DM_TIMELINE_URL = '/api/statuses/dm_timeline.json'
|
|
||||||
const FOLLOWERS_URL = '/api/statuses/followers.json'
|
|
||||||
const FRIENDS_URL = '/api/statuses/friends.json'
|
|
||||||
const FOLLOWING_URL = '/api/friendships/create.json'
|
|
||||||
const UNFOLLOWING_URL = '/api/friendships/destroy.json'
|
|
||||||
const REGISTRATION_URL = '/api/account/register.json'
|
const REGISTRATION_URL = '/api/account/register.json'
|
||||||
const AVATAR_UPDATE_URL = '/api/qvitter/update_avatar.json'
|
const AVATAR_UPDATE_URL = '/api/qvitter/update_avatar.json'
|
||||||
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
|
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
|
||||||
|
@ -31,12 +19,24 @@ const DENY_USER_URL = '/api/pleroma/friendships/deny'
|
||||||
const SUGGESTIONS_URL = '/api/v1/suggestions'
|
const SUGGESTIONS_URL = '/api/v1/suggestions'
|
||||||
|
|
||||||
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
||||||
|
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
|
||||||
|
const MASTODON_UNFAVORITE_URL = id => `/api/v1/statuses/${id}/unfavourite`
|
||||||
|
const MASTODON_RETWEET_URL = id => `/api/v1/statuses/${id}/reblog`
|
||||||
|
const MASTODON_UNRETWEET_URL = id => `/api/v1/statuses/${id}/unreblog`
|
||||||
|
const MASTODON_DELETE_URL = id => `/api/v1/statuses/${id}`
|
||||||
|
const MASTODON_FOLLOW_URL = id => `/api/v1/accounts/${id}/follow`
|
||||||
|
const MASTODON_UNFOLLOW_URL = id => `/api/v1/accounts/${id}/unfollow`
|
||||||
|
const MASTODON_FOLLOWING_URL = id => `/api/v1/accounts/${id}/following`
|
||||||
|
const MASTODON_FOLLOWERS_URL = id => `/api/v1/accounts/${id}/followers`
|
||||||
|
const MASTODON_DIRECT_MESSAGES_TIMELINE_URL = '/api/v1/timelines/direct'
|
||||||
const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
|
const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
|
||||||
|
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
|
||||||
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
|
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
|
||||||
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
|
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
|
||||||
const MASTODON_USER_URL = '/api/v1/accounts'
|
const MASTODON_USER_URL = '/api/v1/accounts'
|
||||||
const MASTODON_USER_RELATIONSHIPS_URL = '/api/v1/accounts/relationships'
|
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_TAG_TIMELINE_URL = tag => `/api/v1/timelines/tag/${tag}`
|
||||||
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_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block`
|
||||||
|
@ -210,7 +210,7 @@ const externalProfile = ({profileUrl, credentials}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const followUser = ({id, credentials}) => {
|
const followUser = ({id, credentials}) => {
|
||||||
let url = `${FOLLOWING_URL}?user_id=${id}`
|
let url = MASTODON_FOLLOW_URL(id)
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
|
@ -218,7 +218,7 @@ const followUser = ({id, credentials}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const unfollowUser = ({id, credentials}) => {
|
const unfollowUser = ({id, credentials}) => {
|
||||||
let url = `${UNFOLLOWING_URL}?user_id=${id}`
|
let url = MASTODON_UNFOLLOW_URL(id)
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
|
@ -275,28 +275,36 @@ const fetchUserRelationship = ({id, credentials}) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchFriends = ({id, page, credentials}) => {
|
const fetchFriends = ({id, maxId, sinceId, limit = 20, credentials}) => {
|
||||||
let url = `${FRIENDS_URL}?user_id=${id}`
|
let url = MASTODON_FOLLOWING_URL(id)
|
||||||
if (page) {
|
const args = [
|
||||||
url = url + `&page=${page}`
|
maxId && `max_id=${maxId}`,
|
||||||
}
|
sinceId && `since_id=${sinceId}`,
|
||||||
|
limit && `limit=${limit}`
|
||||||
|
].filter(_ => _).join('&')
|
||||||
|
|
||||||
|
url = url + (args ? '?' + args : '')
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
.then((data) => data.map(parseUser))
|
.then((data) => data.map(parseUser))
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportFriends = ({id, credentials}) => {
|
const exportFriends = ({id, credentials}) => {
|
||||||
let url = `${FRIENDS_URL}?user_id=${id}&all=true`
|
let url = MASTODON_FOLLOWING_URL(id) + `?all=true`
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
.then((data) => data.map(parseUser))
|
.then((data) => data.map(parseUser))
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchFollowers = ({id, page, credentials}) => {
|
const fetchFollowers = ({id, maxId, sinceId, limit = 20, credentials}) => {
|
||||||
let url = `${FOLLOWERS_URL}?user_id=${id}`
|
let url = MASTODON_FOLLOWERS_URL(id)
|
||||||
if (page) {
|
const args = [
|
||||||
url = url + `&page=${page}`
|
maxId && `max_id=${maxId}`,
|
||||||
}
|
sinceId && `since_id=${sinceId}`,
|
||||||
|
limit && `limit=${limit}`
|
||||||
|
].filter(_ => _).join('&')
|
||||||
|
|
||||||
|
url += args ? '?' + args : ''
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
.then((data) => data.map(parseUser))
|
.then((data) => data.map(parseUser))
|
||||||
|
@ -347,15 +355,15 @@ const fetchStatus = ({id, credentials}) => {
|
||||||
const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false}) => {
|
const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false}) => {
|
||||||
const timelineUrls = {
|
const timelineUrls = {
|
||||||
public: MASTODON_PUBLIC_TIMELINE,
|
public: MASTODON_PUBLIC_TIMELINE,
|
||||||
friends: FRIENDS_TIMELINE_URL,
|
friends: MASTODON_USER_HOME_TIMELINE_URL,
|
||||||
mentions: MENTIONS_URL,
|
mentions: MENTIONS_URL,
|
||||||
dms: DM_TIMELINE_URL,
|
dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL,
|
||||||
notifications: QVITTER_USER_NOTIFICATIONS_URL,
|
notifications: QVITTER_USER_NOTIFICATIONS_URL,
|
||||||
'publicAndExternal': MASTODON_PUBLIC_TIMELINE,
|
'publicAndExternal': MASTODON_PUBLIC_TIMELINE,
|
||||||
user: MASTODON_USER_TIMELINE_URL,
|
user: MASTODON_USER_TIMELINE_URL,
|
||||||
media: MASTODON_USER_TIMELINE_URL,
|
media: MASTODON_USER_TIMELINE_URL,
|
||||||
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
||||||
tag: TAG_TIMELINE_URL
|
tag: MASTODON_TAG_TIMELINE_URL
|
||||||
}
|
}
|
||||||
const isNotifications = timeline === 'notifications'
|
const isNotifications = timeline === 'notifications'
|
||||||
const params = []
|
const params = []
|
||||||
|
@ -373,7 +381,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
|
||||||
params.push(['max_id', until])
|
params.push(['max_id', until])
|
||||||
}
|
}
|
||||||
if (tag) {
|
if (tag) {
|
||||||
url += `/${tag}.json`
|
url = url(tag)
|
||||||
}
|
}
|
||||||
if (timeline === 'media') {
|
if (timeline === 'media') {
|
||||||
params.push(['only_media', 1])
|
params.push(['only_media', 1])
|
||||||
|
@ -420,31 +428,63 @@ const verifyCredentials = (user) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const favorite = ({ id, credentials }) => {
|
const favorite = ({ id, credentials }) => {
|
||||||
return fetch(`${FAVORITE_URL}/${id}.json`, {
|
return fetch(MASTODON_FAVORITE_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
throw new Error('Error favoriting post')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const unfavorite = ({ id, credentials }) => {
|
const unfavorite = ({ id, credentials }) => {
|
||||||
return fetch(`${UNFAVORITE_URL}/${id}.json`, {
|
return fetch(MASTODON_UNFAVORITE_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
throw new Error('Error removing favorite')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const retweet = ({ id, credentials }) => {
|
const retweet = ({ id, credentials }) => {
|
||||||
return fetch(`${RETWEET_URL}/${id}.json`, {
|
return fetch(MASTODON_RETWEET_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
throw new Error('Error repeating post')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const unretweet = ({ id, credentials }) => {
|
const unretweet = ({ id, credentials }) => {
|
||||||
return fetch(`${UNRETWEET_URL}/${id}.json`, {
|
return fetch(MASTODON_UNRETWEET_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
throw new Error('Error removing repeat')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds = [], inReplyToStatusId, contentType}) => {
|
const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds = [], inReplyToStatusId, contentType}) => {
|
||||||
|
@ -481,9 +521,9 @@ const postStatus = ({credentials, status, spoilerText, visibility, sensitive, me
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteStatus = ({ id, credentials }) => {
|
const deleteStatus = ({ id, credentials }) => {
|
||||||
return fetch(`${STATUS_DELETE_URL}/${id}.json`, {
|
return fetch(MASTODON_DELETE_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,16 @@ const backendInteractorService = (credentials) => {
|
||||||
return apiService.fetchConversation({id, credentials})
|
return apiService.fetchConversation({id, credentials})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchFriends = ({id, page}) => {
|
const fetchFriends = ({id, maxId, sinceId, limit}) => {
|
||||||
return apiService.fetchFriends({id, page, credentials})
|
return apiService.fetchFriends({id, maxId, sinceId, limit, credentials})
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportFriends = ({id}) => {
|
const exportFriends = ({id}) => {
|
||||||
return apiService.exportFriends({id, credentials})
|
return apiService.exportFriends({id, credentials})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchFollowers = ({id, page}) => {
|
const fetchFollowers = ({id, maxId, sinceId, limit}) => {
|
||||||
return apiService.fetchFollowers({id, page, credentials})
|
return apiService.fetchFollowers({id, maxId, sinceId, limit, credentials})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchAllFollowing = ({username}) => {
|
const fetchAllFollowing = ({username}) => {
|
||||||
|
|
|
@ -19,7 +19,7 @@ const fetchUser = (attempt, user, store) => new Promise((resolve, reject) => {
|
||||||
export const requestFollow = (user, store) => new Promise((resolve, reject) => {
|
export const requestFollow = (user, store) => new Promise((resolve, reject) => {
|
||||||
store.state.api.backendInteractor.followUser(user.id)
|
store.state.api.backendInteractor.followUser(user.id)
|
||||||
.then((updated) => {
|
.then((updated) => {
|
||||||
store.commit('addNewUsers', [updated])
|
store.commit('updateUserRelationship', [updated])
|
||||||
|
|
||||||
// For locked users we just mark it that we sent the follow request
|
// For locked users we just mark it that we sent the follow request
|
||||||
if (updated.locked) {
|
if (updated.locked) {
|
||||||
|
@ -66,7 +66,7 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
|
||||||
export const requestUnfollow = (user, store) => new Promise((resolve, reject) => {
|
export const requestUnfollow = (user, store) => new Promise((resolve, reject) => {
|
||||||
store.state.api.backendInteractor.unfollowUser(user.id)
|
store.state.api.backendInteractor.unfollowUser(user.id)
|
||||||
.then((updated) => {
|
.then((updated) => {
|
||||||
store.commit('addNewUsers', [updated])
|
store.commit('updateUserRelationship', [updated])
|
||||||
resolve({
|
resolve({
|
||||||
updated
|
updated
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue