Merge remote-tracking branch 'upstream/develop' into feature/scope_preferences
* upstream/develop: 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 On logout switch to public timeline. Put oauth text into description. Display OAuth login on login form button. Add login form back in. Linting. Re-activate registration, use oauth password flow to fetch token. Fix typo. Remove gonsole.logg :DD Fix linting. Move login to oauth.
This commit is contained in:
commit
e06717fd0d
32 changed files with 1576 additions and 279 deletions
|
@ -23,6 +23,7 @@ const defaultState = {
|
|||
disableChat: false,
|
||||
scopeCopy: true,
|
||||
subjectLineBehavior: 'email',
|
||||
loginMethod: 'password',
|
||||
|
||||
// Nasty stuff
|
||||
pleromaBackend: true,
|
||||
|
|
18
src/modules/oauth.js
Normal file
18
src/modules/oauth.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const oauth = {
|
||||
state: {
|
||||
client_id: false,
|
||||
client_secret: false,
|
||||
token: false
|
||||
},
|
||||
mutations: {
|
||||
setClientData (state, data) {
|
||||
state.client_id = data.client_id
|
||||
state.client_secret = data.client_secret
|
||||
},
|
||||
setToken (state, token) {
|
||||
state.token = token
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default oauth
|
|
@ -41,7 +41,8 @@ export const defaultState = {
|
|||
own: emptyTl(),
|
||||
publicAndExternal: emptyTl(),
|
||||
friends: emptyTl(),
|
||||
tag: emptyTl()
|
||||
tag: emptyTl(),
|
||||
dms: emptyTl()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,6 +172,14 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
|||
sortTimeline(mentions)
|
||||
}
|
||||
}
|
||||
if (status.visibility === 'direct') {
|
||||
const dms = state.timelines.dms
|
||||
|
||||
mergeOrAdd(dms.statuses, dms.statusesObject, status)
|
||||
dms.newStatusCount += 1
|
||||
|
||||
sortTimeline(dms)
|
||||
}
|
||||
}
|
||||
|
||||
// Decide if we should treat the status as new for this timeline.
|
||||
|
|
|
@ -82,24 +82,26 @@ const users = {
|
|||
},
|
||||
logout (store) {
|
||||
store.commit('clearCurrentUser')
|
||||
store.commit('setToken', false)
|
||||
store.dispatch('stopFetching', 'friends')
|
||||
store.commit('setBackendInteractor', backendInteractorService())
|
||||
},
|
||||
loginUser (store, userCredentials) {
|
||||
loginUser (store, accessToken) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const commit = store.commit
|
||||
commit('beginLogin')
|
||||
store.rootState.api.backendInteractor.verifyCredentials(userCredentials)
|
||||
store.rootState.api.backendInteractor.verifyCredentials(accessToken)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
response.json()
|
||||
.then((user) => {
|
||||
user.credentials = userCredentials
|
||||
// user.credentials = userCredentials
|
||||
user.credentials = accessToken
|
||||
commit('setCurrentUser', user)
|
||||
commit('addNewUsers', [user])
|
||||
|
||||
// Set our new backend interactor
|
||||
commit('setBackendInteractor', backendInteractorService(userCredentials))
|
||||
commit('setBackendInteractor', backendInteractorService(accessToken))
|
||||
|
||||
if (user.token) {
|
||||
store.dispatch('initializeSocket', user.token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue