-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mark holiday notice messages as bot-generated
- Loading branch information
Showing
3 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2707,6 +2707,29 @@ mod tests { | |
async fn test_is_bot() -> Result<()> { | ||
let alice = TestContext::new_alice().await; | ||
|
||
// Alice receives an auto-generated non-chat message. | ||
// | ||
// This could be a holiday notice, | ||
// in which case the message should be marked as bot-generated, | ||
// but the contact should not. | ||
receive_imf( | ||
&alice, | ||
b"From: Claire <[email protected]>\n\ | ||
To: [email protected]\n\ | ||
Message-ID: <[email protected]>\n\ | ||
Auto-Submitted: auto-generated\n\ | ||
Date: Fri, 29 Jan 2021 21:37:55 +0000\n\ | ||
\n\ | ||
hello\n", | ||
false, | ||
) | ||
.await?; | ||
let msg = alice.get_last_msg().await; | ||
assert_eq!(msg.get_text(), "hello".to_string()); | ||
assert!(msg.is_bot()); | ||
let contact = Contact::get_by_id(&alice, msg.from_id).await?; | ||
assert!(!contact.is_bot()); | ||
|
||
// Alice receives a message from Bob the bot. | ||
receive_imf( | ||
&alice, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters