Merge remote-tracking branch 'upstream/develop' into feature/theming2
* upstream/develop: (60 commits) whoops whoops DM timeline: stream new statuses update-japanese-translation Add actual user search. incorporate most translation changes from MR 368 update french translation Always show dm panel. Add direct message tab. api service url remove deploy stage remove deploy stage updated and completed German translation On logout switch to public timeline. minor modification of Chinese translation update Chinese translation Add Chinese language Fix posting. Put oauth text into description. Display OAuth login on login form button. ...
This commit is contained in:
commit
a806d43f05
56 changed files with 2963 additions and 383 deletions
|
@ -17,7 +17,9 @@ const saveImmedeatelyActions = [
|
|||
'clearCurrentUser',
|
||||
'setCurrentUser',
|
||||
'setHighlight',
|
||||
'setOption'
|
||||
'setOption',
|
||||
'setClientData',
|
||||
'setToken'
|
||||
]
|
||||
|
||||
const defaultStorage = (() => {
|
||||
|
@ -43,8 +45,8 @@ export default function createPersistedState ({
|
|||
storage = defaultStorage,
|
||||
subscriber = store => handler => store.subscribe(handler)
|
||||
} = {}) {
|
||||
return store => {
|
||||
getState(key, storage).then((savedState) => {
|
||||
return getState(key, storage).then((savedState) => {
|
||||
return store => {
|
||||
try {
|
||||
if (typeof savedState === 'object') {
|
||||
// build user cache
|
||||
|
@ -67,8 +69,8 @@ export default function createPersistedState ({
|
|||
value: store.state.config.customTheme
|
||||
})
|
||||
}
|
||||
if (store.state.users.lastLoginName) {
|
||||
store.dispatch('loginUser', {username: store.state.users.lastLoginName, password: 'xxx'})
|
||||
if (store.state.oauth.token) {
|
||||
store.dispatch('loginUser', store.state.oauth.token)
|
||||
}
|
||||
loaded = true
|
||||
} catch (e) {
|
||||
|
@ -76,28 +78,27 @@ export default function createPersistedState ({
|
|||
console.error(e)
|
||||
loaded = true
|
||||
}
|
||||
})
|
||||
|
||||
subscriber(store)((mutation, state) => {
|
||||
try {
|
||||
if (saveImmedeatelyActions.includes(mutation.type)) {
|
||||
setState(key, reducer(state, paths), storage)
|
||||
.then(success => {
|
||||
if (typeof success !== 'undefined') {
|
||||
if (mutation.type === 'setOption') {
|
||||
store.dispatch('settingsSaved', { success })
|
||||
subscriber(store)((mutation, state) => {
|
||||
try {
|
||||
if (saveImmedeatelyActions.includes(mutation.type)) {
|
||||
setState(key, reducer(state, paths), storage)
|
||||
.then(success => {
|
||||
if (typeof success !== 'undefined') {
|
||||
if (mutation.type === 'setOption') {
|
||||
store.dispatch('settingsSaved', { success })
|
||||
}
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
if (mutation.type === 'setOption') {
|
||||
store.dispatch('settingsSaved', { error })
|
||||
}
|
||||
})
|
||||
}, error => {
|
||||
if (mutation.type === 'setOption') {
|
||||
store.dispatch('settingsSaved', { error })
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Couldn't persist state:")
|
||||
console.log(e)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Couldn't persist state:")
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue