From 8c8a6edc7800bac854ef23f29aa87f5b932cb415 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 21:08:14 -0500
Subject: Remove pagination support from block-list
---
src/modules/users.js | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
(limited to 'src/modules/users.js')
diff --git a/src/modules/users.js b/src/modules/users.js
index ce8af68c..1f03b47e 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, union } from 'lodash'
import { set } from 'vue'
import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js'
import oauthApi from '../services/new_api/oauth'
@@ -85,14 +85,9 @@ export const mutations = {
addNewUsers (state, users) {
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
},
- addBlocks (state, { blocks, page }) {
+ addBlocks (state, blockIds) {
const user = state.currentUser
- each(blocks, block => {
- if (!find(user.blocks, { id: block.id })) {
- user.blocks.push(block)
- }
- })
- user.blocksPage = page + 1
+ user.blockIds = union(user.blockIds, blockIds)
},
setUserForStatus (state, status) {
status.user = state.usersObject[status.user.id]
@@ -147,10 +142,10 @@ const users = {
.then((user) => store.commit('addNewUsers', [user]))
},
fetchBlocks (store) {
- const page = store.state.currentUser.blocksPage || 1
- return store.rootState.api.backendInteractor.fetchBlocks({ page })
+ return store.rootState.api.backendInteractor.fetchBlocks()
.then((blocks) => {
- store.commit('addBlocks', { blocks, page })
+ store.commit('addBlocks', map(blocks, 'id'))
+ store.commit('addNewUsers', blocks)
return blocks
})
},
--
cgit v1.2.3-70-g09d2