prefer context.get_config() over context.sql.get_config() as the latter does not handle default values.

This commit is contained in:
B. Petersen
2019-10-03 16:53:23 +02:00
parent b4b8a1d15b
commit c6b2d640ae
8 changed files with 28 additions and 71 deletions

View File

@@ -951,10 +951,7 @@ pub fn get_chat_msgs(context: &Context, chat_id: u32, flags: u32, marker1before:
};
let success = if chat_id == 1 {
let show_emails = context
.sql
.get_config_int(context, "show_emails")
.unwrap_or_default();
let show_emails = context.get_config_int(Config::ShowEmails);
context.sql.query_map(
"SELECT m.id, m.timestamp FROM msgs m \
LEFT JOIN chats ON m.chat_id=chats.id \
@@ -1373,8 +1370,7 @@ pub(crate) fn add_contact_to_chat_ex(
chat.update_param(context).unwrap();
}
let self_addr = context
.sql
.get_config(context, "configured_addr")
.get_config(Config::ConfiguredAddr)
.unwrap_or_default();
if contact.get_addr() == &self_addr {
bail!("invalid attempt to add self e-mail address to group");