Force access token on account data + fix bug

pull/1/head
Bram van den Heuvel 2023-04-04 16:11:50 +02:00
parent bc2d1a183b
commit f18dbcc941
2 changed files with 7 additions and 2 deletions

View File

@ -29,7 +29,8 @@ setAccountDataV1 { content, eventType, roomId } context =
R.callApi "PUT" "/_matrix/client/r0/user/{userId}/account_data/{type}" R.callApi "PUT" "/_matrix/client/r0/user/{userId}/account_data/{type}"
) )
>> R.withAttributes >> R.withAttributes
[ R.replaceInUrl "type" eventType [ R.accessToken
, R.replaceInUrl "type" eventType
, R.replaceInUrl "userId" (Context.getUserId context) , R.replaceInUrl "userId" (Context.getUserId context)
, R.fullBody content , R.fullBody content
] ]
@ -48,7 +49,8 @@ setAccountDataV2 { content, eventType, roomId } context =
R.callApi "PUT" "/_matrix/client/v3/user/{userId}/account_data/{type}" R.callApi "PUT" "/_matrix/client/v3/user/{userId}/account_data/{type}"
) )
>> R.withAttributes >> R.withAttributes
[ R.replaceInUrl "type" eventType [ R.accessToken
, R.replaceInUrl "type" eventType
, R.replaceInUrl "userId" (Context.getUserId context) , R.replaceInUrl "userId" (Context.getUserId context)
, R.fullBody content , R.fullBody content
] ]

View File

@ -334,6 +334,9 @@ updateWith vaultUpdate ((Vault ({ cred, context } as data)) as vault) =
LoggedInWithUsernameAndPassword _ output -> LoggedInWithUsernameAndPassword _ output ->
Vault { data | context = Credentials.addToken output.accessToken context } Vault { data | context = Credentials.addToken output.accessToken context }
getUsername : Vault -> Maybe String
getUsername (Vault { context }) =
Credentials.getUserId context
{-| Set personal account data {-| Set personal account data
-} -}