Files
OurUmbraco/OurUmbraco.Site/Views/Partials/Forum/Comment.cshtml
T
Sebastiaan Janssen c8e2b632ed OUR-123 Can't choose reply for a reply
#OUR-123 Fixed
2015-08-10 15:33:14 +02:00

136 lines
5.9 KiB
Plaintext

@inherits Umbraco.Web.Mvc.UmbracoViewPage<OurUmbraco.Forum.Models.ReadOnlyComment>
@using OurUmbraco.Forum.Extensions
@using OurUmbraco.Powers.Library
@{
var currentMember = Members.GetCurrentMember();
var answer = (int)ViewData["answer"];
var roles = new List<string>();
var commentAuthor = Members.GetById(Model.MemberId);
// author could have been deleted (spammer) so make sure to check if they exist
if (commentAuthor != null)
{
roles = commentAuthor.GetRoles();
}
}
@* If author exists and comment is either not spam or the viewer is a the author or an admin admin *@
@if (commentAuthor != null && (Model.IsSpam == false || (currentMember != null && currentMember.Id == commentAuthor.Id) || Members.IsAdmin()))
{
<li class="comment @(Model.ParentCommentId > 0 ? "level-2" : null) @(Model.Id == answer ? "solution" : null)" data-parent="@Model.ParentCommentId" id="comment-@Model.Id">
<div class="meta">
<div class="profile">
<a href="/member/@commentAuthor.Id">@commentAuthor.Name</a><span>@commentAuthor.Karma() karma points</span>
@if (roles.Any())
{
<span class="roles">
@foreach (var role in roles)
{
<span class="@role">@role</span>
}
</span>
}
</div>
<div class="time" title="@(string.Format("{0:ddd, dd MMM yyyy} {0:HH:mm:ss} UTC+{1}", Model.Created, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)))">
@Model.Created.ConvertToRelativeTime()
</div>
</div>
<div class="comment-inner">
<a href="/member/@commentAuthor.Id" class="photo">@Html.Raw(OurUmbraco.Our.Utils.GetMemberAvatar(commentAuthor, 75))</a>
<div class="highfive highfive-comment">
<div class="highfive-count">
@Model.Score
</div>
@if (Members.IsLoggedIn() && !Utils.HasVoted(currentMember.Id, Model.Id, "powersComment"))
{
if (currentMember.Id != Model.MemberId)
{
<a href="#" data-id="@Model.Id"><img src="/assets/images/highfive.svg" alt="high five" />High Five</a>
}
}
</div>
<div class="body markdown-syntax">
@if (Model.IsSpam)
{
<div class="alert">
@if (Members.IsAdmin())
{
<span>You can see this comment because you're a moderator of the forum.</span><br/><br/>
}
Sorry if we're causing you any inconvenience but this comment has been automatically marked as spam. A moderator has been notified and will evaluate the validity of your comment. <br/>
Only moderators and the comment author starter can see this comment. When this comment has been marked as clean, this comment will be shown as normal.<br/>
</div>
}
@Model.Body.Sanitize()
</div>
</div>
<div class="actions">
@if (Members.IsLoggedIn())
{
<a href="#" class="flag-comment" data-id="@Model.Id" data-member="@currentMember.Id">
<i class="icon-Flag"></i><span>Flag as spam</span>
</a>
if (answer == 0 && (Members.IsAdmin() || currentMember.Id == Model.TopicAuthorId))
{
<a href="#" class="solved" data-id="@Model.Id">
<i class="icon-Check"></i><span>Mark as solution</span>
</a>
}
if (Model.ParentCommentId <= 0)
{
<a href="#" data-author="@commentAuthor.Name" data-topic="@Model.TopicId" data-parent="@Model.Id" data-controller="comment" class="forum-reply reply">
<i class="icon-Reply-arrow"></i><span>Reply</span>
</a>
}
if (Model.ParentCommentId > 0)
{
<a href="#" data-author="@commentAuthor.Name" data-topic="@Model.TopicId" data-parent="@Model.ParentCommentId" data-controller="comment" class="forum-reply reply">
<i class="icon-Reply-arrow"></i><span>Reply</span>
</a>
}
if (Members.IsAdmin() || currentMember.Id == Model.MemberId)
{
<a href="#" class="edit-post" data-id="@Model.Id" data-topic="@Model.TopicId" data-controller="comment">
<i class="icon-Edit"></i><span>Edit</span>
</a>
<a href="#" class="delete-reply" data-id="@Model.Id">
<i class="icon-Delete-key"></i><span>Delete</span>
</a>
if (Members.IsAdmin())
{
if (Model.IsSpam)
{
<a href="#" class="mark-as-ham" data-id="@Model.Id" data-controller="comment">
<i class="icon-Alert-alt"></i><span>Mark as ham</span>
</a>
}
else
{
<a href="#" class="mark-as-spam" data-id="@Model.Id" data-controller="comment">
<i class="icon-Alert-alt"></i><span>Mark as spam</span>
</a>
}
}
}
}
<a href="#" id="copy-link" class="copy-link" data-id="#comment-@Model.Id">
<i class="icon-Link"></i><span>Copy Link</span>
</a>
</div>
</li>
}