<commit_before><?php

class SV_UserTaggingImprovements_XenForo_Model_Post extends XFCP_SV_UserTaggingImprovements_XenForo_Model_Post
{
    protected $resetEmailed = true;

    public function alertQuotedMembers(array $post, array $thread, array $forum)
    {
        SV_UserTaggingImprovements_Globals::$emailedUsers = array();
        $this->resetEmailed = false;

        $quotedUserIds = parent::alertQuotedMembers($post, $thread, $forum);

        if ($quotedUserIds && $this->canPostCanTag($post, $thread, $forum))
        {
            $userTaggingModel = $this->_getUserTaggingModel();
            $userTaggingModel->emailAlertedUsers('post', $post['post_id'], $post, $quotedUserIds, $post, SV_UserTaggingImprovements_XenForo_Model_UserTagging::UserQuotedEmailTemplate);
        }

        return $quotedUserIds;
    }

    public function alertTaggedMembers(array $post, array $thread, array $forum, array $tagged, array $alreadyAlerted)
    {
        if ($this->resetEmailed)
        {
            SV_UserTaggingImprovements_Globals::$emailedUsers = array();
        }
        $this->resetEmailed = true;

        if (!$this->canPostCanTag($post, $thread, $forum))
        {
            return array();
        }

        $userTaggingModel = $this->_getUserTaggingModel();<commit_msg>Only alert users who have not posted in the thread who are quoted<commit_after><?php

class SV_UserTaggingImprovements_XenForo_Model_Post extends XFCP_SV_UserTaggingImprovements_XenForo_Model_Post
{
    protected $resetEmailed = true;

    public function alertQuotedMembers(array $post, array $thread, array $forum)
    {
        SV_UserTaggingImprovements_Globals::$emailedUsers = array();
        $this->resetEmailed = false;

        $quotedUserIds = parent::alertQuotedMembers($post, $thread, $forum);

        $threadId = intval($post['thread_id']);
        if ($threadId && $quotedUserIds && $this->canPostCanTag($post, $thread, $forum))
        {
            $db = $this->_getDb();
            $ids = array();
            foreach($quotedUserIds as $id)
            {
                if ($id = intval($id))
                {
                    $ids[] = "select $id as id";
                }
            }
            $idsToAlert = $db->fetchCol("
                select a.id
                from ( ".join(' union ', $ids)." ) a
                left join xf_thread_user_post on (xf_thread_user_post.thread_id = {$threadId} and xf_thread_user_post.user_id = a.id)
                where xf_thread_user_post.user_id is null
            ");

            if ($idsToAlert)
            {
                $userTaggingModel = $this->_getUserTaggingModel();
                $userTaggingModel->emailAlertedUsers('post', $post['post_id'], $post, $idsToAlert, $post, SV_UserTaggingImprovements_XenForo_Model_UserTagging::UserQuotedEmailTemplate);
            }
        }

        return $quotedUserIds;
    }

    public function alertTaggedMembers(array $post, array $thread, array $forum, array $tagged, array $alreadyAlerted)
    {
        if ($this->resetEmailed)
        {
            SV_UserTaggingImprovements_Globals::$emailedUsers = array();
        }
        $this->resetEmailed = true;

        if (!$this->canPostCanTag($post, $thread, $forum))
        {
            return array();
        }

        $userTaggingModel = $this->_getUserTaggingModel();
{'fraction_non_alphanumeric': 0.11518949567293345, 'fraction_numerical': 0.0, 'mean_word_length': 2.588865096359743, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3227548', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1001, 'n_words': 183}