mark current user as approved in message request migration

This commit is contained in:
Ryan Zhao 2022-03-08 13:55:34 +11:00
parent 9a04c7a4fe
commit b1fb202eab
2 changed files with 7 additions and 1 deletions

View file

@ -14,7 +14,6 @@ enum Onboarding {
let user = Contact(sessionID: x25519PublicKey) let user = Contact(sessionID: x25519PublicKey)
user.isApproved = true user.isApproved = true
user.didApproveMe = true user.didApproveMe = true
user.isTrusted = true
Storage.shared.setContact(user, using: transaction) Storage.shared.setContact(user, using: transaction)
} }
switch self { switch self {

View file

@ -41,6 +41,13 @@ public class MessageRequestsMigration : OWSDatabaseMigration {
threads.append(thread) threads.append(thread)
} }
if let user = Storage.shared.getUser() {
user.isApproved = true
user.didApproveMe = true
contacts.insert(user)
}
Storage.write(with: { transaction in Storage.write(with: { transaction in
contacts.forEach { contact in contacts.forEach { contact in
Storage.shared.setContact(contact, using: transaction) Storage.shared.setContact(contact, using: transaction)