initial implementation of an admin settings module
This commit is contained in:
parent
55ea6df40b
commit
9632b77786
4 changed files with 92 additions and 18 deletions
|
|
@ -551,6 +551,7 @@ const users = {
|
|||
loginUser (store, accessToken) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const commit = store.commit
|
||||
const dispatch = store.dispatch
|
||||
commit('beginLogin')
|
||||
store.rootState.api.backendInteractor.verifyCredentials(accessToken)
|
||||
.then((data) => {
|
||||
|
|
@ -563,59 +564,63 @@ const users = {
|
|||
user.domainMutes = []
|
||||
commit('setCurrentUser', user)
|
||||
commit('setServerSideStorage', user)
|
||||
if (user.rights.moderator || user.rights.admin) {
|
||||
store.rootState.api.backendInteractor.fetchInstanceDBConfig()
|
||||
.then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
|
||||
}
|
||||
commit('addNewUsers', [user])
|
||||
|
||||
store.dispatch('fetchEmoji')
|
||||
dispatch('fetchEmoji')
|
||||
|
||||
getNotificationPermission()
|
||||
.then(permission => commit('setNotificationPermission', permission))
|
||||
|
||||
// Set our new backend interactor
|
||||
commit('setBackendInteractor', backendInteractorService(accessToken))
|
||||
store.dispatch('pushServerSideStorage')
|
||||
dispatch('pushServerSideStorage')
|
||||
|
||||
if (user.token) {
|
||||
store.dispatch('setWsToken', user.token)
|
||||
dispatch('setWsToken', user.token)
|
||||
|
||||
// Initialize the shout socket.
|
||||
store.dispatch('initializeSocket')
|
||||
dispatch('initializeSocket')
|
||||
}
|
||||
|
||||
const startPolling = () => {
|
||||
// Start getting fresh posts.
|
||||
store.dispatch('startFetchingTimeline', { timeline: 'friends' })
|
||||
dispatch('startFetchingTimeline', { timeline: 'friends' })
|
||||
|
||||
// Start fetching notifications
|
||||
store.dispatch('startFetchingNotifications')
|
||||
dispatch('startFetchingNotifications')
|
||||
|
||||
// Start fetching chats
|
||||
store.dispatch('startFetchingChats')
|
||||
dispatch('startFetchingChats')
|
||||
}
|
||||
|
||||
store.dispatch('startFetchingLists')
|
||||
dispatch('startFetchingLists')
|
||||
|
||||
if (user.locked) {
|
||||
store.dispatch('startFetchingFollowRequests')
|
||||
dispatch('startFetchingFollowRequests')
|
||||
}
|
||||
|
||||
if (store.getters.mergedConfig.useStreamingApi) {
|
||||
store.dispatch('fetchTimeline', { timeline: 'friends', since: null })
|
||||
store.dispatch('fetchNotifications', { since: null })
|
||||
store.dispatch('enableMastoSockets', true).catch((error) => {
|
||||
dispatch('fetchTimeline', { timeline: 'friends', since: null })
|
||||
dispatch('fetchNotifications', { since: null })
|
||||
dispatch('enableMastoSockets', true).catch((error) => {
|
||||
console.error('Failed initializing MastoAPI Streaming socket', error)
|
||||
}).then(() => {
|
||||
store.dispatch('fetchChats', { latest: true })
|
||||
setTimeout(() => store.dispatch('setNotificationsSilence', false), 10000)
|
||||
dispatch('fetchChats', { latest: true })
|
||||
setTimeout(() => dispatch('setNotificationsSilence', false), 10000)
|
||||
})
|
||||
} else {
|
||||
startPolling()
|
||||
}
|
||||
|
||||
// Get user mutes
|
||||
store.dispatch('fetchMutes')
|
||||
dispatch('fetchMutes')
|
||||
|
||||
store.dispatch('setLayoutWidth', windowWidth())
|
||||
store.dispatch('setLayoutHeight', windowHeight())
|
||||
dispatch('setLayoutWidth', windowWidth())
|
||||
dispatch('setLayoutHeight', windowHeight())
|
||||
|
||||
// Fetch our friends
|
||||
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue