core: fetch user profile before updating profile

This commit is contained in:
Ammar Ahmed
2024-02-29 23:26:33 +05:00
committed by Abdullah Atta
parent 54ba654b97
commit 85c50bf0fa

View File

@@ -289,11 +289,12 @@ class UserManager {
async setProfile(profile: Partial<Profile>) {
const user = await this.getUser();
const key = await this.getEncryptionKey();
const userProfile = await this.getProfile();
if (!user || !key) return;
user.profile = await this.db
.storage()
.encrypt(key, JSON.stringify({ ...user.profile, ...profile }));
.encrypt(key, JSON.stringify({ ...userProfile, ...profile }));
await this.updateUser(user);
}