Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
api!: jsonrpc: remove contacts from FullChat. To migrate load
contacts on demand via `get_contacts_by_ids` using `FullChat.contactIds`
  • Loading branch information
Simon-Laux committed Oct 8, 2025
commit ff977606710f21303d27b69e6ecf3a47fa22ba07
18 changes: 0 additions & 18 deletions deltachat-jsonrpc/src/api/types/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use serde::{Deserialize, Serialize};
use typescript_type_def::TypeDef;

use super::color_int_to_hex_string;
use super::contact::ContactObject;

#[derive(Serialize, TypeDef, schemars::JsonSchema)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -61,7 +60,6 @@ pub struct FullChat {
chat_type: u32,
is_unpromoted: bool,
is_self_talk: bool,
contacts: Vec<ContactObject>,
contact_ids: Vec<u32>,

/// Contact IDs of the past chat members.
Expand Down Expand Up @@ -89,20 +87,6 @@ impl FullChat {
let contact_ids = get_chat_contacts(context, rust_chat_id).await?;
let past_contact_ids = get_past_chat_contacts(context, rust_chat_id).await?;

let mut contacts = Vec::with_capacity(contact_ids.len());

for contact_id in &contact_ids {
contacts.push(
ContactObject::try_from_dc_contact(
context,
Contact::get_by_id(context, *contact_id)
.await
.context("failed to load contact")?,
)
.await?,
)
}

let profile_image = match chat.get_profile_image(context).await? {
Some(path_buf) => path_buf.to_str().map(|s| s.to_owned()),
None => None,
Expand Down Expand Up @@ -139,7 +123,6 @@ impl FullChat {
chat_type: chat.get_type().to_u32().context("unknown chat type id")?,
is_unpromoted: chat.is_unpromoted(),
is_self_talk: chat.is_self_talk(),
contacts,
contact_ids: contact_ids.iter().map(|id| id.to_u32()).collect(),
past_contact_ids: past_contact_ids.iter().map(|id| id.to_u32()).collect(),
color,
Expand All @@ -157,7 +140,6 @@ impl FullChat {
}

/// cheaper version of fullchat, omits:
/// - contacts
/// - contact_ids
/// - fresh_message_counter
/// - ephemeral_timer
Expand Down