Merge pull request #5600 from element-hq/feature/bma/deletePinCode
Delete pin code only when the last session is deleted
This commit is contained in:
+1
-5
@@ -108,10 +108,6 @@ class DefaultPushService(
|
||||
sessionObserver.addListener(this)
|
||||
}
|
||||
|
||||
override suspend fun onSessionCreated(userId: String) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* The session has been deleted.
|
||||
* In this case, this is not necessary to unregister the pusher from the homeserver,
|
||||
@@ -119,7 +115,7 @@ class DefaultPushService(
|
||||
* The current push provider may want to take action, and we need to
|
||||
* cleanup the stores.
|
||||
*/
|
||||
override suspend fun onSessionDeleted(userId: String) {
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
val sessionId = SessionId(userId)
|
||||
val userPushStore = userPushStoreFactory.getOrCreate(sessionId)
|
||||
val currentPushProviderName = userPushStore.getPushProviderName()
|
||||
|
||||
+1
-3
@@ -59,9 +59,7 @@ class DefaultNotificationConversationService(
|
||||
|
||||
init {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
|
||||
override suspend fun onSessionDeleted(userId: String) {
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
onSessionLogOut(SessionId(userId))
|
||||
}
|
||||
})
|
||||
|
||||
+2
-2
@@ -248,7 +248,7 @@ class DefaultPushServiceTest {
|
||||
),
|
||||
pushClientSecretStore = pushClientSecretStore,
|
||||
)
|
||||
defaultPushService.onSessionDeleted(A_SESSION_ID.value)
|
||||
defaultPushService.onSessionDeleted(A_SESSION_ID.value, false)
|
||||
assertThat(userPushStore.getPushProviderName()).isNull()
|
||||
assertThat(pushClientSecretStore.getSecret(A_SESSION_ID)).isNull()
|
||||
onSessionDeletedLambda.assertions().isCalledOnce().with(value(A_SESSION_ID))
|
||||
@@ -268,7 +268,7 @@ class DefaultPushServiceTest {
|
||||
),
|
||||
pushClientSecretStore = pushClientSecretStore,
|
||||
)
|
||||
defaultPushService.onSessionDeleted(A_SESSION_ID.value)
|
||||
defaultPushService.onSessionDeleted(A_SESSION_ID.value, false)
|
||||
assertThat(userPushStore.getPushProviderName()).isNull()
|
||||
assertThat(pushClientSecretStore.getSecret(A_SESSION_ID)).isNull()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user