|
|
|
@ -20,11 +20,7 @@ const emptyTl = (userId = 0) => ({
|
|
|
|
|
flushMarker: 0
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const defaultState = () => ({
|
|
|
|
|
allStatuses: [],
|
|
|
|
|
allStatusesObject: {},
|
|
|
|
|
maxId: 0,
|
|
|
|
|
notifications: {
|
|
|
|
|
const emptyNotifications = () => ({
|
|
|
|
|
desktopNotificationSilence: true,
|
|
|
|
|
maxId: 0,
|
|
|
|
|
minId: Number.POSITIVE_INFINITY,
|
|
|
|
@ -33,7 +29,13 @@ export const defaultState = () => ({
|
|
|
|
|
loading: false,
|
|
|
|
|
error: false,
|
|
|
|
|
fetcherId: null
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const defaultState = () => ({
|
|
|
|
|
allStatuses: [],
|
|
|
|
|
allStatusesObject: {},
|
|
|
|
|
maxId: 0,
|
|
|
|
|
notifications: emptyNotifications(),
|
|
|
|
|
favorites: new Set(),
|
|
|
|
|
error: false,
|
|
|
|
|
timelines: {
|
|
|
|
@ -340,9 +342,9 @@ export const mutations = {
|
|
|
|
|
oldTimeline.visibleStatusesObject = {}
|
|
|
|
|
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
|
|
|
|
|
},
|
|
|
|
|
setNotificationFetcher (state, { fetcherId }) {
|
|
|
|
|
state.notifications.fetcherId = fetcherId
|
|
|
|
|
},
|
|
|
|
|
// setNotificationFetcher (state, { fetcherId }) {
|
|
|
|
|
// state.notifications.fetcherId = fetcherId
|
|
|
|
|
// },
|
|
|
|
|
resetStatuses (state) {
|
|
|
|
|
const emptyState = defaultState()
|
|
|
|
|
Object.entries(emptyState).forEach(([key, value]) => {
|
|
|
|
@ -352,6 +354,9 @@ export const mutations = {
|
|
|
|
|
clearTimeline (state, { timeline }) {
|
|
|
|
|
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
|
|
|
|
|
},
|
|
|
|
|
clearNotifications (state) {
|
|
|
|
|
state.notifications = emptyNotifications()
|
|
|
|
|
},
|
|
|
|
|
setFavorited (state, { status, value }) {
|
|
|
|
|
const newStatus = state.allStatusesObject[status.id]
|
|
|
|
|
newStatus.favorited = value
|
|
|
|
@ -428,12 +433,12 @@ const statuses = {
|
|
|
|
|
setNotificationsSilence ({ rootState, commit }, { value }) {
|
|
|
|
|
commit('setNotificationsSilence', { value })
|
|
|
|
|
},
|
|
|
|
|
stopFetchingNotifications ({ rootState, commit }) {
|
|
|
|
|
if (rootState.statuses.notifications.fetcherId) {
|
|
|
|
|
window.clearInterval(rootState.statuses.notifications.fetcherId)
|
|
|
|
|
}
|
|
|
|
|
commit('setNotificationFetcher', { fetcherId: null })
|
|
|
|
|
},
|
|
|
|
|
// stopFetchingNotifications ({ rootState, commit }) {
|
|
|
|
|
// if (rootState.statuses.notifications.fetcherId) {
|
|
|
|
|
// window.clearInterval(rootState.statuses.notifications.fetcherId)
|
|
|
|
|
// }
|
|
|
|
|
// commit('setNotificationFetcher', { fetcherId: null })
|
|
|
|
|
// },
|
|
|
|
|
deleteStatus ({ rootState, commit }, status) {
|
|
|
|
|
commit('setDeleted', { status })
|
|
|
|
|
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
|
|
|
|