<commit_before>﻿@using JoinRpg.Web.Helpers
@using JoinRpg.Web.Models
@model CommentViewModel

@helper ShowCommentWithTree(CommentViewModel comment)
{
if (!comment.IsVisibleToPlayer && !comment.HasMasterAccess)
{
    return;
}
var hideClassName = !comment.IsVisibleToPlayer ? "world-object-hidden" : "";
<div class="media @hideClassName">
    <div class="media-left">
        <img class="media-object" style="border:1px solid black" width="64" height="64" src="@Html.Action("GetAvatar", "User", new {comment.Author.UserId})"/>
    </div>
    <div class="media-body">
        <div class="media-heading"> @if (comment.IsCommentByPlayer)
                                    {
                                        <span>Игрок</span>
                                    }
                                    else
                                    {
                                        <span>Мастер</span>
                                    }
            @Html.DisplayFor(model => comment.Author) написал(а) @Html.DisplayFor(c => comment.CreatedTime, "EventTime")
            <strong>
                @if (!comment.IsCommentByPlayer)
                {
                    if (comment.IsVisibleToPlayer)
                    {
                        <span>игроку</span>
                    }
                    else
                    {
                        <span>другим мастерам</span>
                    }
                }
            </strong>
            @if (!comment.IsRead)
            {
                <span class="label label-default" title="Новый комментарий">New</span>
            }
        </div>
        @if (comment.Finance != null)
        {
         @Html.DisplayFor(model => comment.Finance)
        }

        @if (comment.ExtraAction != null)
        {
        <b>@Html.DisplayFor(model => comment.ExtraAction)</b>
        }

        <span>@comment.CommentText.ToHtmlString()</span>
        <a data-toggle="collapse"
                 href="#answerComment@(comment.CommentId)">
            Ответить
        </a>
        <div id ="answerComment@(comment.CommentId)" class="collapse">
            @using (Html.BeginForm("Create", "Comment", FormMethod.Post, new {enctype = "multipart/form-data"}))
            {
                @Html.Partial("AddCommentPartial", new AddCommentViewModel
                {
                    ProjectId = comment.ProjectId,
                    ClaimId = comment.ClaimId,
                    ParentCommentId = comment.CommentId,
                    ParentComment = comment,
                    EnableFinanceAction = comment.Finance != null && comment.Finance.RequireModeration && comment.CanModerateFinance,
                    EnableHideFromUser = comment.HasMasterAccess,
                    HideFromUser = !comment.IsVisibleToPlayer
                })
            }
        </div>


        
            @foreach (var childComment in comment.ChildComments)
            {
            @ShowCommentWithTree(childComment)
            }
    </div>
</div>
}

@ShowCommentWithTree(Model)<commit_msg>Hiding avatars on xtrasmall screens<commit_after>﻿@using JoinRpg.Web.Helpers
@using JoinRpg.Web.Models
@model CommentViewModel

@helper ShowCommentWithTree(CommentViewModel comment)
{
if (!comment.IsVisibleToPlayer && !comment.HasMasterAccess)
{
    return;
}
var hideClassName = !comment.IsVisibleToPlayer ? "world-object-hidden" : "";
<div class="media @hideClassName">
    <div class="media-left hidden-xs">
        <img class="media-object" style="border:1px solid black" width="64" height="64" src="@Html.Action("GetAvatar", "User", new {comment.Author.UserId})"/>
    </div>
    <div class="media-body">
        <div class="media-heading"> @if (comment.IsCommentByPlayer)
                                    {
                                        <span>Игрок</span>
                                    }
                                    else
                                    {
                                        <span>Мастер</span>
                                    }
            @Html.DisplayFor(model => comment.Author) написал(а) @Html.DisplayFor(c => comment.CreatedTime, "EventTime")
            <strong>
                @if (!comment.IsCommentByPlayer)
                {
                    if (comment.IsVisibleToPlayer)
                    {
                        <span>игроку</span>
                    }
                    else
                    {
                        <span>другим мастерам</span>
                    }
                }
            </strong>
            @if (!comment.IsRead)
            {
                <span class="label label-default" title="Новый комментарий">New</span>
            }
        </div>
        @if (comment.Finance != null)
        {
         @Html.DisplayFor(model => comment.Finance)
        }

        @if (comment.ExtraAction != null)
        {
        <b>@Html.DisplayFor(model => comment.ExtraAction)</b>
        }

        <span>@comment.CommentText.ToHtmlString()</span>
        <a data-toggle="collapse"
                 href="#answerComment@(comment.CommentId)">
            Ответить
        </a>
        <div id ="answerComment@(comment.CommentId)" class="collapse">
            @using (Html.BeginForm("Create", "Comment", FormMethod.Post, new {enctype = "multipart/form-data"}))
            {
                @Html.Partial("AddCommentPartial", new AddCommentViewModel
                {
                    ProjectId = comment.ProjectId,
                    ClaimId = comment.ClaimId,
                    ParentCommentId = comment.CommentId,
                    ParentComment = comment,
                    EnableFinanceAction = comment.Finance != null && comment.Finance.RequireModeration && comment.CanModerateFinance,
                    EnableHideFromUser = comment.HasMasterAccess,
                    HideFromUser = !comment.IsVisibleToPlayer
                })
            }
        </div>


        
            @foreach (var childComment in comment.ChildComments)
            {
            @ShowCommentWithTree(childComment)
            }
    </div>
</div>
}

@ShowCommentWithTree(Model)
{'fraction_non_alphanumeric': 0.1122515477354187, 'fraction_numerical': 0.0016291951775822744, 'mean_word_length': 1.4178810555336747, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6333394', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1541, 'n_words': 252}