mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
back to two verification-check functions (#4966)
this pr keeps and refines documentation added in #4951, however, reverts the api introduced by #4951 which turns out to be not useful for UI in practise: UI anyway check for chat/no-chat beforehand, so a simple condition in profiles as `green_checkmark = chat_exist ? chat_is_protected() : contact_is_verified()` is more useful in practise and is waht UI need and did already in the past. (https://github.com/deltachat/deltachat-android/pull/2836 shows a detailed discussion) (as a side effect, beside saving code, this PR saves up to three database calls (get contact from chat in UI to pass it to profile_is_verified(), get chat from contact in core, load is_protected in core) - instead, core can use already is_protected from already loaded chat object) /me did check rust-tests, fingers crossed for python tests /me should re-setup python tests on local machine at some point :)
This commit is contained in:
@@ -1261,9 +1261,8 @@ impl Contact {
|
||||
/// in contact list items and
|
||||
/// in chat member list items.
|
||||
///
|
||||
/// Do not use this function when displaying the contact profile view.
|
||||
/// Display green checkmark in the title of the contact profile
|
||||
/// if [Self::is_profile_verified] returns true.
|
||||
/// In contact profile view, us this function only if there is no chat with the contact,
|
||||
/// otherwise use is_chat_protected().
|
||||
/// Use [Self::get_verifier_id] to display the verifier contact
|
||||
/// in the info section of the contact profile.
|
||||
pub async fn is_verified(&self, context: &Context) -> Result<VerifiedStatus> {
|
||||
@@ -1322,6 +1321,11 @@ impl Contact {
|
||||
/// This generally should be consistent with the 1:1 chat with the contact
|
||||
/// so 1:1 chat with the contact and the contact profile
|
||||
/// either both display the green checkmark or both don't display a green checkmark.
|
||||
///
|
||||
/// UI often knows beforehand if a chat exists and can also call
|
||||
/// `chat.is_protected()` (if there is a chat)
|
||||
/// or `contact.is_verified()` (if there is no chat) directly.
|
||||
/// This is often easier and also skips some database calls.
|
||||
pub async fn is_profile_verified(&self, context: &Context) -> Result<bool> {
|
||||
let contact_id = self.id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user