mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 09:56:35 +03:00
clippy
This commit is contained in:
@@ -3867,13 +3867,13 @@ pub(crate) async fn load_broadcast_shared_secret(
|
||||
context: &Context,
|
||||
chat_id: ChatId,
|
||||
) -> Result<Option<String>> {
|
||||
Ok(context
|
||||
context
|
||||
.sql
|
||||
.query_get_value(
|
||||
"SELECT secret FROM broadcasts_shared_secrets WHERE chat_id=?",
|
||||
(chat_id,),
|
||||
)
|
||||
.await?)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn save_broadcast_shared_secret(
|
||||
@@ -5213,7 +5213,7 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_sync_create_chat(&self, action: &SyncAction, grpid: &String) -> Result<bool> {
|
||||
async fn handle_sync_create_chat(&self, action: &SyncAction, grpid: &str) -> Result<bool> {
|
||||
Ok(match action {
|
||||
SyncAction::CreateOutBroadcast {
|
||||
chat_name,
|
||||
@@ -5222,7 +5222,7 @@ impl Context {
|
||||
create_broadcast_ex(
|
||||
self,
|
||||
Nosync,
|
||||
grpid.clone(),
|
||||
grpid.to_string(),
|
||||
chat_name.clone(),
|
||||
shared_secret.to_string(),
|
||||
)
|
||||
|
||||
@@ -2649,17 +2649,17 @@ async fn test_broadcast_change_name() -> Result<()> {
|
||||
let fiona = &tcm.fiona().await;
|
||||
|
||||
tcm.section("Alice sends a message to Bob");
|
||||
let chat_alice = alice.create_chat(&bob).await;
|
||||
send_text_msg(&alice, chat_alice.id, "hi!".to_string()).await?;
|
||||
let chat_alice = alice.create_chat(bob).await;
|
||||
send_text_msg(alice, chat_alice.id, "hi!".to_string()).await?;
|
||||
bob.recv_msg(&alice.pop_sent_msg().await).await;
|
||||
|
||||
tcm.section("Bob sends a message to Alice");
|
||||
let chat_bob = bob.create_chat(&alice).await;
|
||||
send_text_msg(&bob, chat_bob.id, "ho!".to_string()).await?;
|
||||
let chat_bob = bob.create_chat(alice).await;
|
||||
send_text_msg(bob, chat_bob.id, "ho!".to_string()).await?;
|
||||
let msg = alice.recv_msg(&bob.pop_sent_msg().await).await;
|
||||
assert!(msg.get_showpadlock());
|
||||
|
||||
let broadcast_id = create_broadcast(&alice, "Channel".to_string()).await?;
|
||||
let broadcast_id = create_broadcast(alice, "Channel".to_string()).await?;
|
||||
let qr = get_securejoin_qr(alice, Some(broadcast_id)).await.unwrap();
|
||||
|
||||
tcm.section("Alice invites Bob to her channel");
|
||||
@@ -2669,7 +2669,7 @@ async fn test_broadcast_change_name() -> Result<()> {
|
||||
|
||||
{
|
||||
tcm.section("Alice changes the chat name");
|
||||
set_chat_name(&alice, broadcast_id, "My great broadcast").await?;
|
||||
set_chat_name(alice, broadcast_id, "My great broadcast").await?;
|
||||
let sent = alice.pop_sent_msg().await;
|
||||
|
||||
tcm.section("Bob receives the name-change system message");
|
||||
@@ -2687,15 +2687,15 @@ async fn test_broadcast_change_name() -> Result<()> {
|
||||
|
||||
{
|
||||
tcm.section("Alice changes the chat name again, but the system message is lost somehow");
|
||||
set_chat_name(&alice, broadcast_id, "Broadcast channel").await?;
|
||||
set_chat_name(alice, broadcast_id, "Broadcast channel").await?;
|
||||
|
||||
let chat = Chat::load_from_db(&alice, broadcast_id).await?;
|
||||
let chat = Chat::load_from_db(alice, broadcast_id).await?;
|
||||
assert_eq!(chat.typ, Chattype::OutBroadcast);
|
||||
assert_eq!(chat.name, "Broadcast channel");
|
||||
assert!(!chat.is_self_talk());
|
||||
|
||||
tcm.section("Alice sends a text message 'ola!'");
|
||||
send_text_msg(&alice, broadcast_id, "ola!".to_string()).await?;
|
||||
send_text_msg(alice, broadcast_id, "ola!".to_string()).await?;
|
||||
let msg = alice.get_last_msg().await;
|
||||
assert_eq!(msg.chat_id, chat.id);
|
||||
}
|
||||
@@ -2717,7 +2717,7 @@ async fn test_broadcast_change_name() -> Result<()> {
|
||||
assert_eq!(msg.subject, "Re: Broadcast channel");
|
||||
assert!(msg.get_showpadlock());
|
||||
assert!(msg.get_override_sender_name().is_none());
|
||||
let chat = Chat::load_from_db(&bob, msg.chat_id).await?;
|
||||
let chat = Chat::load_from_db(bob, msg.chat_id).await?;
|
||||
assert_eq!(chat.typ, Chattype::InBroadcast);
|
||||
assert_ne!(chat.id, chat_bob.id);
|
||||
assert_eq!(chat.name, "Broadcast channel");
|
||||
@@ -2760,7 +2760,7 @@ async fn test_broadcast_multidev() -> Result<()> {
|
||||
set_chat_name(alice0, a0_broadcast_id, "Broadcast channel 42").await?;
|
||||
let sent_msg = alice0.send_text(a0_broadcast_id, "hi").await;
|
||||
let msg = alice1.recv_msg(&sent_msg).await;
|
||||
let a1_broadcast_id = get_chat_id_by_grpid(&alice1, &a0_broadcast_chat.grpid)
|
||||
let a1_broadcast_id = get_chat_id_by_grpid(alice1, &a0_broadcast_chat.grpid)
|
||||
.await?
|
||||
.unwrap()
|
||||
.0;
|
||||
|
||||
@@ -8,7 +8,7 @@ use chrono::SubsecRound;
|
||||
use deltachat_contact_tools::EmailAddress;
|
||||
use pgp::armor::BlockType;
|
||||
use pgp::composed::{
|
||||
ArmorOptions, Deserializable, InnerRingResult, KeyType as PgpKeyType, Message, MessageBuilder,
|
||||
ArmorOptions, Deserializable, KeyType as PgpKeyType, Message, MessageBuilder,
|
||||
SecretKeyParamsBuilder, SignedPublicKey, SignedPublicSubKey, SignedSecretKey,
|
||||
StandaloneSignature, SubkeyParamsBuilder, TheRing,
|
||||
};
|
||||
@@ -272,7 +272,7 @@ pub fn decrypt(
|
||||
session_keys: vec![],
|
||||
allow_legacy: false,
|
||||
};
|
||||
let (msg, ring_result) = msg.decrypt_the_ring(ring, true)?;
|
||||
let (msg, _ring_result) = msg.decrypt_the_ring(ring, true)?;
|
||||
|
||||
// remove one layer of compression
|
||||
let msg = msg.decompress()?;
|
||||
|
||||
@@ -6,7 +6,6 @@ use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
|
||||
|
||||
use crate::chat::{
|
||||
self, Chat, ChatId, ChatIdBlocked, ProtectionStatus, get_chat_id_by_grpid,
|
||||
load_broadcast_shared_secret,
|
||||
};
|
||||
use crate::chatlist_events;
|
||||
use crate::config::Config;
|
||||
|
||||
@@ -857,8 +857,8 @@ async fn test_send_avatar_in_securejoin() -> Result<()> {
|
||||
//exec_securejoin_broadcast(&tcm, alice, bob).await;
|
||||
}
|
||||
|
||||
let alice_on_bob = bob.add_or_lookup_contact_no_key(&alice).await;
|
||||
let avatar = alice_on_bob.get_profile_image(&bob).await?.unwrap();
|
||||
let alice_on_bob = bob.add_or_lookup_contact_no_key(alice).await;
|
||||
let avatar = alice_on_bob.get_profile_image(bob).await?.unwrap();
|
||||
assert_eq!(
|
||||
avatar.file_name().unwrap().to_str().unwrap(),
|
||||
AVATAR_64x64_DEDUPLICATED
|
||||
|
||||
Reference in New Issue
Block a user