Conversation
|
This didn't fix the bug when I tried it out on Android together with @adbenitez. Adding a debug log: diff --git a/src/receive_imf.rs b/src/receive_imf.rs
index 9c7a2395c..7a48025e1 100644
--- a/src/receive_imf.rs
+++ b/src/receive_imf.rs
@@ -1080,6 +1080,10 @@ pub(crate) async fn receive_imf_inner(
&& fresh
&& !is_old_contact_request
&& !skip_bot_notify;
+ info!(
+ context,
+ "dbg important: {important}, parts: {:?}", mime_parser.parts
+ );
for msg_id in &received_msg.msg_ids {
chat_id.emit_msg_event(context, *msg_id, important);yields: so, the location message did contain a text part, with empty text. It's weird that this seems to be different in the Rust tests written by @iequidoo |
7884c51 to
c71346e
Compare
c71346e to
1e67d1c
Compare
| #[derive(Debug)] | ||
| pub struct EventTracker(EventEmitter); | ||
|
|
||
| pub mod event_tracker { |
There was a problem hiding this comment.
Why put this into an extra module? Since all the other event tracking logic is not in this module, it looks like this should also not be in an extra module.
There was a problem hiding this comment.
This is just a syntactic sugar because EventTracker is a tuple struct and can't have GetMatchingArgs inside. It's also what Rust suggests when i try to add it to impl EventTracker:
error: struct is not supported in `trait`s or `impl`s
[...]
= help: consider moving the struct out to a nearby module scope
I want to have GetMatchingArgs as a struct so that get_matching_ex() is really extensible, i.e. if new args with reasonable defaults are added, you don't need to fix up all usages of the function.
There was a problem hiding this comment.
Seems surprising to have a module called event_tracker, but EventTracker is outside of it. Just not putting it into a module, and then renaming it, looks cleaner:
diff --git a/src/location.rs b/src/location.rs
index d78edc645..ac0ff2a47 100644
--- a/src/location.rs
+++ b/src/location.rs
@@ -873,3 +873,3 @@ mod tests {
use crate::receive_imf::receive_imf;
- use crate::test_utils::{TestContext, TestContextManager, event_tracker::GetMatchingArgs};
+ use crate::test_utils::{ExpectedEvents, TestContext, TestContextManager};
use crate::tools::SystemTime;
@@ -1127,3 +1127,3 @@ async fn test_delete_expired_locations() -> Result<()> {
bob,
- GetMatchingArgs {
+ ExpectedEvents {
expected: |e| matches!(e, EventType::MsgsChanged { .. }),
diff --git a/src/test_utils.rs b/src/test_utils.rs
index 2470d95b9..94bdce166 100644
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -1433,7 +1433,4 @@ pub fn fiona_keypair() -> SignedSecretKey {
-pub mod event_tracker {
- use super::EventType;
-
/// See [`super::EventTracker::get_matching_ex`].
- pub struct GetMatchingArgs<E: Fn(&EventType) -> bool, U: Fn(&EventType) -> bool> {
+pub struct ExpectedEvents<E: Fn(&EventType) -> bool, U: Fn(&EventType) -> bool> {
pub expected: E,
@@ -1441,3 +1438,2 @@ pub struct GetMatchingArgs<E: Fn(&EventType) -> bool, U: Fn(&EventType) -> bool>
}
-}
@@ -1487,3 +1483,3 @@ pub async fn get_matching_opt<F: Fn(&EventType) -> bool>(
ctx,
- event_tracker::GetMatchingArgs {
+ ExpectedEvents {
expected: event_matcher,
@@ -1500,3 +1496,3 @@ pub async fn get_matching_ex<E: Fn(&EventType) -> bool, U: Fn(&EventType) -> boo
ctx: &Context,
- args: event_tracker::GetMatchingArgs<E, U>,
+ args: ExpectedEvents<E, U>,
) -> Option<EventType> {There was a problem hiding this comment.
I went ahead and pushed a commit with this change because Github doesn't have a good UI for suggesting medium-sized diffs
…ial parts (#8157) An example of such messages is location-only messages. Co-authored-by: Hocuri <hocuri@gmx.de>
4eeffd1 to
53bcad3
Compare
An example of such messages is location-only messages.
Fix #8157