Merge branch 'develop' into feat/media-modal
This commit is contained in:
commit
c7cffbb6c7
32 changed files with 349 additions and 50 deletions
|
@ -20,6 +20,9 @@ const api = {
|
|||
removeFetcher (state, {timeline}) {
|
||||
delete state.fetchers[timeline]
|
||||
},
|
||||
setWsToken (state, token) {
|
||||
state.wsToken = token
|
||||
},
|
||||
setSocket (state, socket) {
|
||||
state.socket = socket
|
||||
},
|
||||
|
@ -51,10 +54,14 @@ const api = {
|
|||
window.clearInterval(fetcher)
|
||||
store.commit('removeFetcher', {timeline})
|
||||
},
|
||||
initializeSocket (store, token) {
|
||||
setWsToken (store, token) {
|
||||
store.commit('setWsToken', token)
|
||||
},
|
||||
initializeSocket (store) {
|
||||
// Set up websocket connection
|
||||
if (!store.state.chatDisabled) {
|
||||
let socket = new Socket('/socket', {params: {token: token}})
|
||||
const token = store.state.wsToken
|
||||
const socket = new Socket('/socket', {params: {token}})
|
||||
socket.connect()
|
||||
store.dispatch('initializeChat', socket)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { remove, slice, each, find, maxBy, minBy, merge, last, isArray } from 'l
|
|||
import apiService from '../services/api/api.service.js'
|
||||
// import parse from '../services/status_parser/status_parser.js'
|
||||
|
||||
const emptyTl = () => ({
|
||||
const emptyTl = (userId = 0) => ({
|
||||
statuses: [],
|
||||
statusesObject: {},
|
||||
faves: [],
|
||||
|
@ -14,7 +14,7 @@ const emptyTl = () => ({
|
|||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
userId: 0,
|
||||
userId,
|
||||
flushMarker: 0
|
||||
})
|
||||
|
||||
|
@ -28,6 +28,7 @@ export const defaultState = {
|
|||
minId: Number.POSITIVE_INFINITY,
|
||||
data: [],
|
||||
idStore: {},
|
||||
loading: false,
|
||||
error: false
|
||||
},
|
||||
favorites: new Set(),
|
||||
|
@ -319,7 +320,7 @@ export const mutations = {
|
|||
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
|
||||
},
|
||||
clearTimeline (state, { timeline }) {
|
||||
state.timelines[timeline] = emptyTl()
|
||||
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
|
||||
},
|
||||
setFavorited (state, { status, value }) {
|
||||
const newStatus = state.allStatusesObject[status.id]
|
||||
|
@ -348,6 +349,9 @@ export const mutations = {
|
|||
setError (state, { value }) {
|
||||
state.error = value
|
||||
},
|
||||
setNotificationsLoading (state, { value }) {
|
||||
state.notifications.loading = value
|
||||
},
|
||||
setNotificationsError (state, { value }) {
|
||||
state.notifications.error = value
|
||||
},
|
||||
|
@ -376,6 +380,9 @@ const statuses = {
|
|||
setError ({ rootState, commit }, { value }) {
|
||||
commit('setError', { value })
|
||||
},
|
||||
setNotificationsLoading ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsLoading', { value })
|
||||
},
|
||||
setNotificationsError ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsError', { value })
|
||||
},
|
||||
|
|
|
@ -91,7 +91,9 @@ export const getters = {
|
|||
userById: state => id =>
|
||||
state.users.find(user => user.id === id),
|
||||
userByName: state => name =>
|
||||
state.users.find(user => user.screen_name === name)
|
||||
state.users.find(user => user.screen_name &&
|
||||
(user.screen_name.toLowerCase() === name.toLowerCase())
|
||||
)
|
||||
}
|
||||
|
||||
export const defaultState = {
|
||||
|
@ -222,10 +224,10 @@ const users = {
|
|||
commit('setBackendInteractor', backendInteractorService(accessToken))
|
||||
|
||||
if (user.token) {
|
||||
store.dispatch('initializeSocket', user.token)
|
||||
store.dispatch('setWsToken', user.token)
|
||||
}
|
||||
|
||||
// Start getting fresh tweets.
|
||||
// Start getting fresh posts.
|
||||
store.dispatch('startFetching', 'friends')
|
||||
|
||||
// Get user mutes and follower info
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue