diff options
| author | dave <starpumadev@gmail.com> | 2019-03-28 09:54:55 -0400 |
|---|---|---|
| committer | dave <starpumadev@gmail.com> | 2019-03-28 09:54:55 -0400 |
| commit | e24145e2335a55c20ebbca59247e1d0b74d67bee (patch) | |
| tree | ee778ed93d1f8ddc4ab3229feb1769b1c44e66f9 /src/modules | |
| parent | 43e97e590c98d1f1bb500f96d2b604b968fbbbb3 (diff) | |
| parent | e2e3a65c44c1bd73d3d727333e6163e9b0d07653 (diff) | |
Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma-fe into issue-433-status-reply-form
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/statuses.js | 14 | ||||
| -rw-r--r-- | src/modules/users.js | 26 |
2 files changed, 13 insertions, 27 deletions
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index a16342e0..944b45c1 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -433,13 +433,6 @@ const statuses = { // Optimistic favoriting... commit('setFavorited', { status, value: true }) apiService.favorite({ id: status.id, credentials: rootState.users.currentUser.credentials }) - .then(response => { - if (response.ok) { - return response.json() - } else { - return {} - } - }) .then(status => { commit('setFavoritedConfirm', { status }) }) @@ -448,13 +441,6 @@ const statuses = { // Optimistic favoriting... commit('setFavorited', { status, value: false }) apiService.unfavorite({ id: status.id, credentials: rootState.users.currentUser.credentials }) - .then(response => { - if (response.ok) { - return response.json() - } else { - return {} - } - }) .then(status => { commit('setFavoritedConfirm', { status }) }) diff --git a/src/modules/users.js b/src/modules/users.js index 5cfa128e..1a507d31 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -1,5 +1,5 @@ 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 { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js' import oauthApi from '../services/new_api/oauth' @@ -52,23 +52,23 @@ export const mutations = { state.loggingIn = false }, // TODO Clean after ourselves? - addFriends (state, { id, friends, page }) { + addFriends (state, { id, friends }) { const user = state.usersObject[id] each(friends, friend => { if (!find(user.friends, { id: friend.id })) { 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] each(followers, follower => { if (!find(user.followers, { id: follower.id })) { 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 // outside of viewing someones user profile. @@ -78,7 +78,7 @@ export const mutations = { return } user.friends = [] - user.friendsPage = 0 + user.lastFriendId = null }, clearFollowers (state, userId) { const user = state.usersObject[userId] @@ -86,7 +86,7 @@ export const mutations = { return } user.followers = [] - user.followersPage = 0 + user.lastFollowerId = null }, addNewUsers (state, users) { each(users, (user) => mergeOrAdd(state.users, state.usersObject, user)) @@ -219,10 +219,10 @@ const users = { addFriends ({ rootState, commit }, fetchBy) { return new Promise((resolve, reject) => { const user = rootState.users.usersObject[fetchBy] - const page = user.friendsPage || 1 - rootState.api.backendInteractor.fetchFriends({ id: user.id, page }) + const maxId = user.lastFriendId + rootState.api.backendInteractor.fetchFriends({ id: user.id, maxId }) .then((friends) => { - commit('addFriends', { id: user.id, friends, page }) + commit('addFriends', { id: user.id, friends }) resolve(friends) }).catch(() => { reject() @@ -231,10 +231,10 @@ const users = { }, addFollowers ({ rootState, commit }, fetchBy) { const user = rootState.users.usersObject[fetchBy] - const page = user.followersPage || 1 - return rootState.api.backendInteractor.fetchFollowers({ id: user.id, page }) + const maxId = user.lastFollowerId + return rootState.api.backendInteractor.fetchFollowers({ id: user.id, maxId }) .then((followers) => { - commit('addFollowers', { id: user.id, followers, page }) + commit('addFollowers', { id: user.id, followers }) return followers }) }, |
