Commit 8b379968 authored by Shpuld Shpludson's avatar Shpuld Shpludson

Merge branch 'fix-fetch-follow-request-for-mobile' into 'develop'

Fix follow request for mobile

See merge request !1005
parents 377b8988 09956587
Pipeline #20242 passed with stages
in 4 minutes and 6 seconds
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
const NavPanel = { const NavPanel = {
created () { created () {
if (this.currentUser && this.currentUser.locked) { if (this.currentUser && this.currentUser.locked) {
const store = this.$store this.$store.dispatch('startFetchingFollowRequest')
const credentials = store.state.users.currentUser.credentials
followRequestFetcher.startFetching({ store, credentials })
} }
}, },
computed: { computed: {
......
...@@ -10,6 +10,10 @@ const SideDrawer = { ...@@ -10,6 +10,10 @@ const SideDrawer = {
}), }),
created () { created () {
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer) this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
if (this.currentUser && this.currentUser.locked) {
this.$store.dispatch('startFetchingFollowRequest')
}
}, },
components: { UserCard }, components: { UserCard },
computed: { computed: {
......
...@@ -43,6 +43,13 @@ const api = { ...@@ -43,6 +43,13 @@ const api = {
const fetcher = store.state.backendInteractor.startFetchingNotifications({ store }) const fetcher = store.state.backendInteractor.startFetchingNotifications({ store })
store.commit('addFetcher', { fetcherName: 'notifications', fetcher }) store.commit('addFetcher', { fetcherName: 'notifications', fetcher })
}, },
startFetchingFollowRequest (store) {
// Don't start fetching if we already are.
if (store.state.fetchers['followRequest']) return
const fetcher = store.state.backendInteractor.startFetchingFollowRequest({ store })
store.commit('addFetcher', { fetcherName: 'followRequest', fetcher })
},
stopFetching (store, fetcherName) { stopFetching (store, fetcherName) {
const fetcher = store.state.fetchers[fetcherName] const fetcher = store.state.fetchers[fetcherName]
window.clearInterval(fetcher) window.clearInterval(fetcher)
......
...@@ -434,6 +434,7 @@ const users = { ...@@ -434,6 +434,7 @@ const users = {
store.dispatch('stopFetching', 'friends') store.dispatch('stopFetching', 'friends')
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken())) store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
store.dispatch('stopFetching', 'notifications') store.dispatch('stopFetching', 'notifications')
store.dispatch('stopFetching', 'followRequest')
store.commit('clearNotifications') store.commit('clearNotifications')
store.commit('resetStatuses') store.commit('resetStatuses')
}) })
......
import apiService from '../api/api.service.js' import apiService from '../api/api.service.js'
import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js' import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js'
import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js' import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js'
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
const backendInteractorService = credentials => { const backendInteractorService = credentials => {
const fetchStatus = ({ id }) => { const fetchStatus = ({ id }) => {
...@@ -63,6 +64,10 @@ const backendInteractorService = credentials => { ...@@ -63,6 +64,10 @@ const backendInteractorService = credentials => {
return notificationsFetcher.startFetching({ store, credentials }) return notificationsFetcher.startFetching({ store, credentials })
} }
const startFetchingFollowRequest = ({ store }) => {
return followRequestFetcher.startFetching({ store, credentials })
}
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const tagUser = ({ screen_name }, tag) => { const tagUser = ({ screen_name }, tag) => {
return apiService.tagUser({ screen_name, tag, credentials }) return apiService.tagUser({ screen_name, tag, credentials })
...@@ -111,7 +116,6 @@ const backendInteractorService = credentials => { ...@@ -111,7 +116,6 @@ const backendInteractorService = credentials => {
const subscribeUser = (id) => apiService.subscribeUser({ credentials, id }) const subscribeUser = (id) => apiService.subscribeUser({ credentials, id })
const unsubscribeUser = (id) => apiService.unsubscribeUser({ credentials, id }) const unsubscribeUser = (id) => apiService.unsubscribeUser({ credentials, id })
const fetchBlocks = () => apiService.fetchBlocks({ credentials }) const fetchBlocks = () => apiService.fetchBlocks({ credentials })
const fetchFollowRequests = () => apiService.fetchFollowRequests({ credentials })
const fetchOAuthTokens = () => apiService.fetchOAuthTokens({ credentials }) const fetchOAuthTokens = () => apiService.fetchOAuthTokens({ credentials })
const revokeOAuthToken = (id) => apiService.revokeOAuthToken({ id, credentials }) const revokeOAuthToken = (id) => apiService.revokeOAuthToken({ id, credentials })
const fetchPinnedStatuses = (id) => apiService.fetchPinnedStatuses({ credentials, id }) const fetchPinnedStatuses = (id) => apiService.fetchPinnedStatuses({ credentials, id })
...@@ -168,6 +172,7 @@ const backendInteractorService = credentials => { ...@@ -168,6 +172,7 @@ const backendInteractorService = credentials => {
verifyCredentials: apiService.verifyCredentials, verifyCredentials: apiService.verifyCredentials,
startFetchingTimeline, startFetchingTimeline,
startFetchingNotifications, startFetchingNotifications,
startFetchingFollowRequest,
fetchMutes, fetchMutes,
muteUser, muteUser,
unmuteUser, unmuteUser,
...@@ -203,7 +208,6 @@ const backendInteractorService = credentials => { ...@@ -203,7 +208,6 @@ const backendInteractorService = credentials => {
mfaSetupOTP, mfaSetupOTP,
mfaConfirmOTP, mfaConfirmOTP,
mfaDisableOTP, mfaDisableOTP,
fetchFollowRequests,
approveUser, approveUser,
denyUser, denyUser,
vote, vote,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment