mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
add Message.post_message_view_type to jsonrpc api, to get the real viewtype of a pre-message.
This commit is contained in:
@@ -48,6 +48,9 @@ pub struct MessageObject {
|
||||
has_location: bool,
|
||||
has_html: bool,
|
||||
view_type: MessageViewtype,
|
||||
/// If message is a Pre-Message,
|
||||
/// then this returns the viewtype it will have when it is downloaded.
|
||||
post_message_view_type: Option<MessageViewtype>,
|
||||
state: u32,
|
||||
|
||||
/// An error text, if there is one.
|
||||
@@ -212,6 +215,7 @@ impl MessageObject {
|
||||
has_location: message.has_location(),
|
||||
has_html: message.has_html(),
|
||||
view_type: message.get_viewtype().into(),
|
||||
post_message_view_type: message.get_post_message_viewtype().map(Into::into),
|
||||
state: message
|
||||
.get_state()
|
||||
.to_u32()
|
||||
@@ -683,6 +687,9 @@ pub struct MessageInfo {
|
||||
rfc724_mid: String,
|
||||
server_urls: Vec<String>,
|
||||
hop_info: String,
|
||||
/// If message is a Pre-Message,
|
||||
/// then this returns the viewtype it will have when it is downloaded.
|
||||
post_message_view_type: Option<MessageViewtype>,
|
||||
}
|
||||
|
||||
impl MessageInfo {
|
||||
@@ -706,6 +713,7 @@ impl MessageInfo {
|
||||
rfc724_mid: message.rfc724_mid().to_owned(),
|
||||
server_urls,
|
||||
hop_info,
|
||||
post_message_view_type: message.get_post_message_viewtype().map(Into::into),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,8 +861,7 @@ impl Message {
|
||||
|
||||
/// If message is a Pre-Message,
|
||||
/// then this returns the viewtype it will have when it is downloaded.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn get_post_message_viewtype(&self) -> Option<Viewtype> {
|
||||
pub fn get_post_message_viewtype(&self) -> Option<Viewtype> {
|
||||
if self.download_state != DownloadState::Done {
|
||||
if let Some(viewtype) = self
|
||||
.param
|
||||
|
||||
Reference in New Issue
Block a user