mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26: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:
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
### API-Changes
|
### API-Changes
|
||||||
- jsonrpc: add python API for webxdc updates #3872
|
- jsonrpc: add python API for webxdc updates #3872
|
||||||
|
- jsonrpc: add fresh message count to ChatListItemFetchResult::ArchiveLink
|
||||||
- Add ffi functions to retrieve `verified by` information #3786
|
- Add ffi functions to retrieve `verified by` information #3786
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
@@ -48,12 +48,10 @@ pub enum ChatListItemFetchResult {
|
|||||||
dm_chat_contact: Option<u32>,
|
dm_chat_contact: Option<u32>,
|
||||||
was_seen_recently: bool,
|
was_seen_recently: bool,
|
||||||
},
|
},
|
||||||
ArchiveLink,
|
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Error {
|
ArchiveLink { fresh_message_counter: usize },
|
||||||
id: u32,
|
#[serde(rename_all = "camelCase")]
|
||||||
error: String,
|
Error { id: u32, error: String },
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn get_chat_list_item_by_id(
|
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)),
|
_ => Some(MsgId::new(entry.1)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let fresh_message_counter = chat_id.get_fresh_msg_cnt(ctx).await?;
|
||||||
|
|
||||||
if chat_id.is_archived_link() {
|
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?;
|
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)
|
(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?);
|
let color = color_int_to_hex_string(chat.get_color(ctx).await?);
|
||||||
|
|
||||||
Ok(ChatListItemFetchResult::ChatListItem {
|
Ok(ChatListItemFetchResult::ChatListItem {
|
||||||
|
|||||||
Reference in New Issue
Block a user