From fb2aca06de230a1d52ab5ac50e8916c9d4a8decb Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 27 Mar 2019 22:02:46 +0200 Subject: [PATCH] review --- src/modules/users.js | 6 +++--- src/services/api/api.service.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/users.js b/src/modules/users.js index 61d05462..cc10b89d 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' @@ -59,7 +59,7 @@ export const mutations = { user.friends.push(friend) } }) - user.lastFriendId = friends.slice(-1)[0].id + user.lastFriendId = last(friends).id }, addFollowers (state, { id, followers }) { const user = state.usersObject[id] @@ -68,7 +68,7 @@ export const mutations = { user.followers.push(follower) } }) - user.lastFollowerId = followers.slice(-1)[0].id + user.lastFollowerId = last(followers).id }, // Because frontend doesn't have a reason to keep these stuff in memory // outside of viewing someones user profile. diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index a8de736c..cf4acdf7 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -280,7 +280,7 @@ const fetchFriends = ({id, maxId, sinceId, limit = 20, credentials}) => { let url = MASTODON_FOLLOWING_URL(id) const args = [ maxId && `max_id=${maxId}`, - sinceId && `max_id=${sinceId}`, + sinceId && `since_id=${sinceId}`, limit && `limit=${limit}` ].filter(_ => _).join('&') @@ -301,11 +301,11 @@ const fetchFollowers = ({id, maxId, sinceId, limit = 20, credentials}) => { let url = MASTODON_FOLLOWERS_URL(id) const args = [ maxId && `max_id=${maxId}`, - sinceId && `max_id=${sinceId}`, + sinceId && `since_id=${sinceId}`, limit && `limit=${limit}` ].filter(_ => _).join('&') - url = url + (args ? '?' + args : '') + url += args ? '?' + args : '' return fetch(url, { headers: authHeaders(credentials) }) .then((data) => data.json()) .then((data) => data.map(parseUser))