TF-586 Fix only show identities created by the user

This commit is contained in:
dab246
2022-05-26 15:19:30 +07:00
committed by Dat H. Pham
parent 81eca6c59a
commit ba64136357
4 changed files with 8 additions and 39 deletions
@@ -190,8 +190,10 @@ class ComposerController extends BaseController {
_getEmailContentSuccess(success);
} if (success is GetAllIdentitiesSuccess) {
if (success.identities?.isNotEmpty == true) {
listIdentities.value = success.identities ?? [];
setIdentityDefault();
listIdentities.value = success.identities!
.where((identity) => identity.mayDelete == true)
.toList();
selectIdentity(listIdentities.first);
}
}
});
@@ -927,12 +929,6 @@ class ComposerController extends BaseController {
}
void setIdentityDefault() {
try {
final identityDefault = listIdentities.firstWhere((identity) => identity.mayDelete == false);
selectIdentity(identityDefault);
} catch (exception) {
selectIdentity(listIdentities.first);
}
}
void selectIdentity(Identity? newIdentity) {