using JoinRpg.DataModel;
using JoinRpg.Domain;
using Microsoft.AspNetCore.Mvc;

namespace JoinRpg.Portal.Controllers.Comments
{
    internal static class CommentRedirectHelper
    {
        public static ActionResult RedirectToDiscussion(IUrlHelper Url, CommentDiscussion discussion, int? commentId = null)
        {
            var extra = commentId != null ? $"#comment{commentId}" : null;
            var claim = discussion.GetClaim();
            if (claim != null)
            {
                var actionLink = Url.Action("Edit", "Claim", new { claim.ClaimId, discussion.ProjectId });
                return new RedirectResult(actionLink + extra);
            }
            var forumThread = discussion.GetForumThread();
            if (forumThread != null)
            {
                var actionLink = Url.Action("ViewThread", new { discussion.ProjectId, forumThread.ForumThreadId });
                return new RedirectResult(actionLink + extra);
            }
            return new NotFoundResult();
        }
    }
}

using JoinRpg.DataModel;
using JoinRpg.Domain;
using Microsoft.AspNetCore.Mvc;

namespace JoinRpg.Portal.Controllers.Comments
{
    internal static class CommentRedirectHelper
    {
        public static ActionResult RedirectToDiscussion(IUrlHelper Url, CommentDiscussion discussion, int? commentId = null)
        {
            var extra = commentId != null ? $"#comment{commentId}" : null;
            var claim = discussion.GetClaim();
            if (claim != null)
            {
                var actionLink = Url.Action("Edit", "Claim", new { claim.ClaimId, discussion.ProjectId });
                return new RedirectResult(actionLink + extra);
            }
            var forumThread = discussion.GetForumThread();
            if (forumThread != null)
            {
                var actionLink = Url.Action("ViewThread", "Forum", new { discussion.ProjectId, forumThread.ForumThreadId });
                return new RedirectResult(actionLink + extra);
            }
            return new NotFoundResult();
        }
    }
}

Fix bug about not redirecting to forums
Fix bug about not redirecting to forums
