Move check for blocked contact from mimefactory to SendMdn job

This commit is contained in:
Alexander Krotov
2020-01-17 01:29:26 +03:00
parent a5c8e9e72e
commit a7d88973be
2 changed files with 9 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ use crate::chat;
use crate::config::Config;
use crate::configure::*;
use crate::constants::*;
use crate::contact::Contact;
use crate::context::{Context, PerformJobsNeeded};
use crate::dc_tools::*;
use crate::error::{Error, Result};
@@ -261,6 +262,12 @@ impl Job {
return Status::Finished(Err(format_err!("MDNs are disabled")));
}
let contact_id = self.foreign_id;
let contact = job_try!(Contact::load_from_db(context, contact_id));
if contact.is_blocked() {
return Status::Finished(Err(format_err!("Contact is blocked")));
}
let msg_id = if let Some(msg_id) = self.param.get_msg_id() {
msg_id
} else {