fn check_post(&mut self, post: &PostEntry, blacklist_line: &LineToken) {
        let post_tags = post.tags.clone().combine_tags();
        for tag in &blacklist_line.tags {
            match &tag.tag_type {
                TagType::Rating(rating) => {
                    self.flag_rating(rating, post, tag.negated);
                    continue;
                }
                TagType::Id(id) => {
                    if let Some(blacklisted_id) = id {
                        self.flag_id(*blacklisted_id, post.id, tag.negated);
                    }
                    continue;
                }
                TagType::User(_) => {
                    let user_id = tag
                        .name
                        .parse::<i64>()
                        .with_context(|e| {
                            error!("Failed to parse blacklisted user id: {}!", tag.name);
                            format!("{}", e)
                        })
                        .unwrap();
                    self.flag_user(user_id, post.uploader_id, tag.negated);
                    continue;
                }
                TagType::None => {
                    if post_tags.iter().any(|e| e == tag.name.as_str()) {
                        self.raise_flag(tag.negated);
                    }
                }
            }
        }

        if self.negated_margin != 0 && self.negated_flags == self.negated_margin {
            self.flagged = false;
        } else if self.flags == self.margin {
            self.flagged = true;
        }
    }
/// Checks if a single post is blacklisted or safe.
Checks if a single post is blacklisted or safe.
Checks if a single post is blacklisted or safe .
fn check_post(&mut self, post: &PostEntry, blacklist_line: &LineToken) {
        let post_tags = post.tags.clone().combine_tags();
        for tag in &blacklist_line.tags {
            match &tag.tag_type {
                TagType::Rating(rating) => {
                    self.flag_rating(rating, post, tag.negated);
                    continue;
                }
                TagType::Id(id) => {
                    if let Some(blacklisted_id) = id {
                        self.flag_id(*blacklisted_id, post.id, tag.negated);
                    }
                    continue;
                }
                TagType::User(_) => {
                    let user_id = tag
                        .name
                        .parse::<i64>()
                        .with_context(|e| {
                            error!("Failed to parse blacklisted user id: {}!", tag.name);
                            format!("{}", e)
                        })
                        .unwrap();
                    self.flag_user(user_id, post.uploader_id, tag.negated);
                    continue;
                }
                TagType::None => {
                    if post_tags.iter().any(|e| e == tag.name.as_str()) {
                        self.raise_flag(tag.negated);
                    }
                }
            }
        }
        if self.negated_margin != 0 && self.negated_flags == self.negated_margin {
            self.flagged = false;
        } else if self.flags == self.margin {
            self.flagged = true;
        }
    }
fn check_post ( & mut self , post : & PostEntry , blacklist_line : & LineToken ) { let post_tags = post . tags . clone ( ) . combine_tags ( ) ; for tag in & blacklist_line . tags { match & tag . tag_type { TagType :: Rating ( rating ) => { self . flag_rating ( rating , post , tag . negated ) ; continue ; } TagType :: Id ( id ) => { if let Some ( blacklisted_id ) = id { self . flag_id ( * blacklisted_id , post . id , tag . negated ) ; } continue ; } TagType :: User ( _ ) => { let user_id = tag . name . parse :: < i64 > ( ) . with_context ( | e | { error ! ( " " tag name ) ; format ! ( " " e ) } ) . unwrap ( ) ; self . flag_user ( user_id , post . uploader_id , tag . negated ) ; continue ; } TagType :: None => { if post_tags . iter ( ) . any ( | e | e == tag . name . as_str ( ) ) { self . raise_flag ( tag . negated ) ; } } } } if self . negated_margin != 0 && self . negated_flags == self . negated_margin { self . flagged = false ; } else if self . flags == self . margin { self . flagged = true ; } }
Checks if a single post is blacklisted or safe.
Checks if a single post is blacklisted or safe .
&mut self
post
&PostEntry
blacklist_line
&LineToken
&mut self
post
&PostEntry
blacklist_line
&LineToken