From a79bf2dfa9b0e23ccc33cb2f6568eb2dcf4715ad Mon Sep 17 00:00:00 2001 From: Ed Cragg Date: Fri, 7 Feb 2020 23:31:00 +0800 Subject: [PATCH] Fix repost test: don't add to db if pre-post found, but later negated Even if a pre-post is found, various configurations can cause the result of this look up to be ignored, meaning another pre-post entry will be added to the database. Add a flag to preserve this state, even if the actual result of the pre-post look up is masked by configuration. Also fix 0.0.0.0 to 127.0.0.1 after rebase. --- src/message.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/message.rs b/src/message.rs index 496f87e9..bf62b951 100644 --- a/src/message.rs +++ b/src/message.rs @@ -194,6 +194,12 @@ fn process_titles(rtd: &Rtd, db: &Database, msg: &Msg) -> impl Iterator impl Iterator { // add new log entry to database, if posted in a channel - if rtd.conf.features.history && msg.is_chanmsg { + if rtd.conf.features.history && !pre_post_found && msg.is_chanmsg { if let Err(err) = db.add_log(&entry) { error!("SQL error: {}", err); } @@ -530,7 +536,7 @@ mod tests { rtd.conf.features.mask_highlights = false; - let msg2 = Msg::new(&rtd, "testnick", "#test2", "http://0.0.0.0:8084/"); + let msg2 = Msg::new(&rtd, "testnick", "#test2", "http://127.0.0.1:8084/"); // cross-posted history is disabled let res: Vec<_> = process_titles(&rtd, &db, &msg2).collect();