From ec14b58351280b503e706944c2af2306dce6d922 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 21:16:57 -0400 Subject: [PATCH] Fix error with liking/disliking of blogs. --- Project-Unite/Controllers/BlogController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project-Unite/Controllers/BlogController.cs b/Project-Unite/Controllers/BlogController.cs index d1aa0f9..15591df 100644 --- a/Project-Unite/Controllers/BlogController.cs +++ b/Project-Unite/Controllers/BlogController.cs @@ -33,7 +33,7 @@ namespace Project_Unite.Controllers var uid = User.Identity.GetUserId(); if (topic == null) return new HttpStatusCodeResult(404); - if (topic.EditHistory.OrderBy(x => x.EditedAt).First().UserId == User.Identity.GetUserId()) + if (topic.AuthorId == User.Identity.GetUserId()) return RedirectToAction("Index", new { id = id, triedtolikeowntopic = true }); var like = db.Likes.Where(x => x.Topic == topic.Id).FirstOrDefault(x => x.User == uid); if (like != null) @@ -69,7 +69,7 @@ namespace Project_Unite.Controllers var uid = User.Identity.GetUserId(); if (topic == null) return new HttpStatusCodeResult(404); - if (topic.EditHistory.OrderBy(x => x.EditedAt).First().UserId == User.Identity.GetUserId()) + if (topic.AuthorId == User.Identity.GetUserId()) return RedirectToAction("Index", new { id = id, triedtolikeowntopic = true }); var like = db.Likes.Where(x => x.Topic == topic.Id).FirstOrDefault(x => x.User == uid); if (like != null)