<commit_before><?php
/* @var $model common\models\Ticket */
$comments = $model->getCommentsHierarchy();
$newComment = new \common\models\TicketComments();
?>
<div class="comments">
    <p class="title"><?= empty($comments) ? 'No comments' : 'Comments:' ?></p>
    <?php foreach ($comments as $comment): ?>
        <?= $this->render('/ticket/review/_comment-item', ['model' => $comment['comment'], 'showDeleteButton' => true]) ?>
        <?php if (isset($comment['answer'])): ?>
            <?= $this->render('/ticket/review/_comment-item', ['model' => $comment['answer'], 'showDeleteButton' => true]) ?>
        <?php endif; ?>
        <?php if ($comment['comment']->status == \common\models\TicketComments::STATUS_NEW): ?>
            <div id="reply-to-<?= $comment['comment']->id ?>" class="reply-to">
                <p class="title">Write a Reply:</p>
                <?php
                $form = yii\widgets\ActiveForm::begin([
                            'action' => ['ticket/add-comment']
                        ])
                ?>
                <?= $form->field($newComment, 'text')->textarea()->label(false) ?>
                <?= $form->field($newComment, 'ticket_id')->hiddenInput(['value' => $model->id])->label(false) ?>
                <?= $form->field($newComment, 'user_id')->hiddenInput(['value' => Yii::$app->user->id])->label(false) ?>
                <?= $form->field($newComment, 'answer_to')->hiddenInput(['value' => $comment['comment']->id])->label(false) ?>
                <?= yii\helpers\Html::hiddenInput('redirect', 'ticket/view') ?>
                <?= yii\helpers\Html::submitButton(Yii::t('app', 'Reply'), ['id' => 'comment-send', 'class' => 'btn btn-success']) ?>
                <?php yii\widgets\ActiveForm::end(); ?>
            </div>
        <?php endif; ?>
    <?php endforeach; ?>
    <p class="title">Write a Comment:</p>
    <?php
    $form = yii\widgets\ActiveForm::begin([
                'action' => ['ticket/add-comment']
            ])
    ?>
    <?= $form->field($newComment, 'text')->textarea()->label(false) ?>
    <?= $form->field($newComment, 'ticket_id')->hiddenInput(['value' => $model->id])->label(false) ?>
    <?= $form->field($newComment, 'user_id')->hiddenInput(['value' => Yii::$app->user->id])->label(false) ?>
    <?= yii\helpers\Html::hiddenInput('redirect', 'ticket/view') ?>
    <?= yii\helpers\Html::submitButton(Yii::t('app', 'Send'), ['id' => 'comment-send', 'class' => 'btn btn-success']) ?>
    <?php yii\widgets\ActiveForm::end(); ?><commit_msg>fix 10) Когда отвечаешь на коммент получается какая-то визуальная глупость. и окно для реплая, и окно для своего коммента. Можно как-то почистить?<commit_after><?php
/* @var $model common\models\Ticket */
$comments = $model->getCommentsHierarchy();
$newComment = new \common\models\TicketComments();
?>
<div class="comments">
    <p class="title"><?= empty($comments) ? 'No comments' : 'Comments:' ?></p>
    <?php foreach ($comments as $comment): ?>
        <?= $this->render('/ticket/review/_comment-item', ['model' => $comment['comment'], 'showDeleteButton' => true]) ?>
        <?php if (isset($comment['answer'])): ?>
            <?= $this->render('/ticket/review/_comment-item', ['model' => $comment['answer'], 'showDeleteButton' => true]) ?>
        <?php endif; ?>
        <?php if ($comment['comment']->status == \common\models\TicketComments::STATUS_NEW): ?>
            <div id="reply-to-<?= $comment['comment']->id ?>" class="reply-to">
                <p class="title">Write a Reply:</p>
                <?php
                $form = yii\widgets\ActiveForm::begin([
                            'action' => ['ticket/add-comment']
                        ])
                ?>
                <?= $form->field($newComment, 'text')->textarea()->label(false) ?>
                <?= $form->field($newComment, 'ticket_id')->hiddenInput(['value' => $model->id])->label(false) ?>
                <?= $form->field($newComment, 'user_id')->hiddenInput(['value' => Yii::$app->user->id])->label(false) ?>
                <?= $form->field($newComment, 'answer_to')->hiddenInput(['value' => $comment['comment']->id])->label(false) ?>
                <?= yii\helpers\Html::hiddenInput('redirect', 'ticket/view') ?>
                <?= yii\helpers\Html::submitButton(Yii::t('app', 'Reply'), ['id' => 'comment-send', 'class' => 'btn btn-success']) ?>
                <?php yii\widgets\ActiveForm::end(); ?>
            </div>
        <?php endif; ?>
    <?php endforeach; ?>
{'fraction_non_alphanumeric': 0.23558227566243597, 'fraction_numerical': 0.00044533511467379205, 'mean_word_length': 2.849185946872322, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 143, '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': '4878889', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1361, 'n_words': 213}