Move business_connection_id from Message to MessageCommon

This commit is contained in:
Akshett Rai Jindal 2024-08-24 13:25:15 +05:30
parent cef553eeae
commit 08d7d8f6b4
3 changed files with 8 additions and 10 deletions

View file

@ -59,12 +59,6 @@ pub struct Message {
/// connected business account. /// connected business account.
pub sender_business_bot: Option<User>, pub sender_business_bot: Option<User>,
/// Unique identifier of the business connection from which the message was
/// received. If non-empty, the message belongs to a chat of the
/// corresponding business account that is independent from any potential
/// bot chat which might share the same identifier.
pub business_connection_id: Option<BusinessConnectionId>,
#[serde(flatten)] #[serde(flatten)]
pub kind: MessageKind, pub kind: MessageKind,
} }
@ -170,6 +164,12 @@ pub struct MessageCommon {
/// an away or a greeting business message, or as a scheduled message /// an away or a greeting business message, or as a scheduled message
#[serde(default, skip_serializing_if = "std::ops::Not::not")] #[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub is_from_offline: bool, pub is_from_offline: bool,
/// Unique identifier of the business connection from which the message was
/// received. If non-empty, the message belongs to a chat of the
/// corresponding business account that is independent from any potential
/// bot chat which might share the same identifier.
pub business_connection_id: Option<BusinessConnectionId>,
} }
#[serde_with::skip_serializing_none] #[serde_with::skip_serializing_none]
@ -1917,7 +1917,6 @@ mod tests {
chat_full_info: ChatFullInfo::default() chat_full_info: ChatFullInfo::default()
}, },
sender_business_bot: None, sender_business_bot: None,
business_connection_id: None,
kind: MessageKind::ChatShared(MessageChatShared { kind: MessageKind::ChatShared(MessageChatShared {
chat_shared: ChatShared { chat_shared: ChatShared {
request_id: RequestId(348349), request_id: RequestId(348349),
@ -2590,7 +2589,6 @@ mod tests {
}, },
via_bot: None, via_bot: None,
sender_business_bot: None, sender_business_bot: None,
business_connection_id: None,
kind: MessageKind::Giveaway(MessageGiveaway { kind: MessageKind::Giveaway(MessageGiveaway {
giveaway: Giveaway { giveaway: Giveaway {
chats: vec![Chat { chats: vec![Chat {

View file

@ -609,7 +609,6 @@ mod test {
chat_full_info: ChatFullInfo::default(), chat_full_info: ChatFullInfo::default(),
}, },
sender_business_bot: None, sender_business_bot: None,
business_connection_id: None,
kind: MessageKind::Common(MessageCommon { kind: MessageKind::Common(MessageCommon {
reply_to_message: None, reply_to_message: None,
forward_origin: None, forward_origin: None,
@ -634,6 +633,7 @@ mod test {
is_automatic_forward: false, is_automatic_forward: false,
has_protected_content: false, has_protected_content: false,
is_from_offline: false, is_from_offline: false,
business_connection_id: None,
}), }),
}), }),
}; };

View file

@ -190,7 +190,6 @@ mod tests {
sender_chat: None, sender_chat: None,
is_topic_message: false, is_topic_message: false,
sender_business_bot: None, sender_business_bot: None,
business_connection_id: None,
date, date,
chat: Chat { chat: Chat {
id: ChatId(109_998_024), id: ChatId(109_998_024),
@ -239,6 +238,7 @@ mod tests {
reply_to_story: None, reply_to_story: None,
sender_boost_count: None, sender_boost_count: None,
is_from_offline: false, is_from_offline: false,
business_connection_id: None,
}), }),
}), }),
} }