mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
cargo fmt
This commit is contained in:
18
src/chat.rs
18
src/chat.rs
@@ -1907,7 +1907,7 @@ pub fn forward_msgs(context: &Context, msg_ids: &[MsgId], chat_id: u32) -> Resul
|
|||||||
pub fn get_info_json(context: &Context, chat_id: u32) -> Result<String, Error> {
|
pub fn get_info_json(context: &Context, chat_id: u32) -> Result<String, Error> {
|
||||||
let chat = Chat::load_from_db(context, chat_id).unwrap();
|
let chat = Chat::load_from_db(context, chat_id).unwrap();
|
||||||
|
|
||||||
// ToDo:
|
// ToDo:
|
||||||
// - [x] id
|
// - [x] id
|
||||||
// - [x] type
|
// - [x] type
|
||||||
// - [x] name
|
// - [x] name
|
||||||
@@ -1924,19 +1924,17 @@ pub fn get_info_json(context: &Context, chat_id: u32) -> Result<String, Error> {
|
|||||||
|
|
||||||
let profile_image = match chat.get_profile_image(context) {
|
let profile_image = match chat.get_profile_image(context) {
|
||||||
Some(path) => path.into_os_string().into_string().unwrap(),
|
Some(path) => path.into_os_string().into_string().unwrap(),
|
||||||
None => "".to_string()
|
None => "".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let draft = match get_draft(context, chat_id) {
|
let draft = match get_draft(context, chat_id) {
|
||||||
Ok(message) => {
|
Ok(message) => match message {
|
||||||
match message {
|
Some(m) => m.text.unwrap_or("".to_string()),
|
||||||
Some(m) => m.text.unwrap_or("".to_string()) ,
|
None => "".to_string(),
|
||||||
None => "".to_string()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Err(_) => "".to_string()
|
Err(_) => "".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = json!({
|
let s = json!({
|
||||||
"id": chat.id,
|
"id": chat.id,
|
||||||
"type": chat.typ as u32,
|
"type": chat.typ as u32,
|
||||||
@@ -1950,7 +1948,7 @@ pub fn get_info_json(context: &Context, chat_id: u32) -> Result<String, Error> {
|
|||||||
"subtitle": chat.get_subtitle(context),
|
"subtitle": chat.get_subtitle(context),
|
||||||
"draft": draft
|
"draft": draft
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(s.to_string())
|
Ok(s.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user