Skip to content

Commit 50ae9b7

Browse files
committed
api!: remove is_profile_verified APIs
UIs now display green checkmark in a profile if the contact is verified. Chats with key-contacts cannot become unprotected, so there is no need to check 1:1 chat.
1 parent 0f5f59d commit 50ae9b7

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

deltachat-jsonrpc/src/api/types/contact.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ pub struct ContactObject {
3838
/// See [`Self::verifier_id`]/`Contact.verifierId` for a guidance how to display these information.
3939
is_verified: bool,
4040

41-
/// True if the contact profile title should have a green checkmark.
42-
///
43-
/// This indicates whether 1:1 chat has a green checkmark
44-
/// or will have a green checkmark if created.
45-
is_profile_verified: bool,
46-
4741
/// The contact ID that verified a contact.
4842
///
4943
/// As verifier may be unknown,
@@ -87,7 +81,6 @@ impl ContactObject {
8781
None => None,
8882
};
8983
let is_verified = contact.is_verified(context).await?;
90-
let is_profile_verified = contact.is_profile_verified(context).await?;
9184

9285
let verifier_id = contact
9386
.get_verifier_id(context)
@@ -109,7 +102,6 @@ impl ContactObject {
109102
is_key_contact: contact.is_key_contact(),
110103
e2ee_avail: contact.e2ee_avail(context).await?,
111104
is_verified,
112-
is_profile_verified,
113105
verifier_id,
114106
last_seen: contact.last_seen(),
115107
was_seen_recently: contact.was_seen_recently(),

src/contact.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use tokio::task;
2121
use tokio::time::{Duration, timeout};
2222

2323
use crate::blob::BlobObject;
24-
use crate::chat::{ChatId, ChatIdBlocked, ProtectionStatus};
24+
use crate::chat::ChatId;
2525
use crate::color::str_to_color;
2626
use crate::config::Config;
2727
use crate::constants::{self, Blocked, Chattype};
@@ -1650,29 +1650,6 @@ impl Contact {
16501650
}
16511651
}
16521652

1653-
/// Returns if the contact profile title should display a green checkmark.
1654-
///
1655-
/// This generally should be consistent with the 1:1 chat with the contact
1656-
/// so 1:1 chat with the contact and the contact profile
1657-
/// either both display the green checkmark or both don't display a green checkmark.
1658-
///
1659-
/// UI often knows beforehand if a chat exists and can also call
1660-
/// `chat.is_protected()` (if there is a chat)
1661-
/// or `contact.is_verified()` (if there is no chat) directly.
1662-
/// This is often easier and also skips some database calls.
1663-
pub async fn is_profile_verified(&self, context: &Context) -> Result<bool> {
1664-
let contact_id = self.id;
1665-
1666-
if let Some(ChatIdBlocked { id: chat_id, .. }) =
1667-
ChatIdBlocked::lookup_by_contact(context, contact_id).await?
1668-
{
1669-
Ok(chat_id.is_protected(context).await? == ProtectionStatus::Protected)
1670-
} else {
1671-
// 1:1 chat does not exist.
1672-
Ok(self.is_verified(context).await?)
1673-
}
1674-
}
1675-
16761653
/// Returns the number of real (i.e. non-special) contacts in the database.
16771654
pub async fn get_real_cnt(context: &Context) -> Result<usize> {
16781655
if !context.sql.is_open().await {

src/contact/contact_tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use deltachat_contact_tools::{addr_cmp, may_be_valid_addr};
22

33
use super::*;
4-
use crate::chat::{Chat, get_chat_contacts, send_text_msg};
4+
use crate::chat::{Chat, ProtectionStatus, get_chat_contacts, send_text_msg};
55
use crate::chatlist::Chatlist;
66
use crate::receive_imf::receive_imf;
77
use crate::test_utils::{self, TestContext, TestContextManager, TimeShiftFalsePositiveNote};
@@ -1302,7 +1302,6 @@ async fn test_self_is_verified() -> Result<()> {
13021302

13031303
let contact = Contact::get_by_id(&alice, ContactId::SELF).await?;
13041304
assert_eq!(contact.is_verified(&alice).await?, true);
1305-
assert!(contact.is_profile_verified(&alice).await?);
13061305
assert!(contact.get_verifier_id(&alice).await?.is_none());
13071306
assert!(contact.is_key_contact());
13081307

0 commit comments

Comments
 (0)