mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
jsonrpc: add fresh message count to the archive-link chatlistitem variant (#3920)
this is a followup to #3918 I went with option "C" from my comment: https://github.com/deltachat/deltachat-core-rust/pull/3918#issuecomment-1371224339 - Archive link is (still) very different from a normal chat, so most of the options would be empty / not relevant - avatar path is not needed as desktop renders it differently anyway, it's not really a chat like saved messages or device messages where it made more sense for the core to supply the icon, vs. using the svg directly. - translating the string in the coreas stock-string is more annoying than doing it from the ui, especially when this special pseudo chat has different rendering anyway so also no need to provide a name property
This commit is contained in:
@@ -48,12 +48,10 @@ pub enum ChatListItemFetchResult {
|
||||
dm_chat_contact: Option<u32>,
|
||||
was_seen_recently: bool,
|
||||
},
|
||||
ArchiveLink,
|
||||
#[serde(rename_all = "camelCase")]
|
||||
Error {
|
||||
id: u32,
|
||||
error: String,
|
||||
},
|
||||
ArchiveLink { fresh_message_counter: usize },
|
||||
#[serde(rename_all = "camelCase")]
|
||||
Error { id: u32, error: String },
|
||||
}
|
||||
|
||||
pub(crate) async fn get_chat_list_item_by_id(
|
||||
@@ -66,8 +64,12 @@ pub(crate) async fn get_chat_list_item_by_id(
|
||||
_ => Some(MsgId::new(entry.1)),
|
||||
};
|
||||
|
||||
let fresh_message_counter = chat_id.get_fresh_msg_cnt(ctx).await?;
|
||||
|
||||
if chat_id.is_archived_link() {
|
||||
return Ok(ChatListItemFetchResult::ArchiveLink);
|
||||
return Ok(ChatListItemFetchResult::ArchiveLink {
|
||||
fresh_message_counter,
|
||||
});
|
||||
}
|
||||
|
||||
let chat = Chat::load_from_db(ctx, chat_id).await?;
|
||||
@@ -111,7 +113,6 @@ pub(crate) async fn get_chat_list_item_by_id(
|
||||
(None, false)
|
||||
};
|
||||
|
||||
let fresh_message_counter = chat_id.get_fresh_msg_cnt(ctx).await?;
|
||||
let color = color_int_to_hex_string(chat.get_color(ctx).await?);
|
||||
|
||||
Ok(ChatListItemFetchResult::ChatListItem {
|
||||
|
||||
Reference in New Issue
Block a user