mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 17:06:35 +03:00
refactor: return the reason when failing to place calls
This commit is contained in:
@@ -183,7 +183,11 @@ impl Context {
|
|||||||
place_call_info: String,
|
place_call_info: String,
|
||||||
) -> Result<MsgId> {
|
) -> Result<MsgId> {
|
||||||
let chat = Chat::load_from_db(self, chat_id).await?;
|
let chat = Chat::load_from_db(self, chat_id).await?;
|
||||||
ensure!(chat.typ == Chattype::Single && !chat.is_self_talk());
|
ensure!(
|
||||||
|
chat.typ == Chattype::Single,
|
||||||
|
"Can only place calls in 1:1 chats"
|
||||||
|
);
|
||||||
|
ensure!(!chat.is_self_talk(), "Cannot call self");
|
||||||
|
|
||||||
let mut call = Message {
|
let mut call = Message {
|
||||||
viewtype: Viewtype::Call,
|
viewtype: Viewtype::Call,
|
||||||
|
|||||||
Reference in New Issue
Block a user