From cd73cc80d1c097e584938ffe993bd546bab9d31a Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 24 Mar 2017 15:54:53 -0400 Subject: Notification daemon works. You now get notifications when someone you follow makes a post - or when a user replies to a topic you made. --- Project-Unite/Controllers/ProfilesController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Project-Unite/Controllers/ProfilesController.cs') diff --git a/Project-Unite/Controllers/ProfilesController.cs b/Project-Unite/Controllers/ProfilesController.cs index 4e5e436..9a1073e 100644 --- a/Project-Unite/Controllers/ProfilesController.cs +++ b/Project-Unite/Controllers/ProfilesController.cs @@ -142,7 +142,8 @@ namespace Project_Unite.Controllers return RedirectToAction("ViewProfile", new { id = ACL.UserNameRaw(tid) }); } - + [HttpPost] + [ValidateAntiForgeryToken] public ActionResult PostContent(UserPost model) { var db = new ApplicationDbContext(); @@ -151,6 +152,8 @@ namespace Project_Unite.Controllers model.UserId = User.Identity.GetUserId(); db.UserPosts.Add(model); db.SaveChanges(); + NotificationDaemon.NotifyFollowers(User.Identity.GetUserId(), "New post from " + ACL.UserNameRaw(User.Identity.GetUserId()) + "!", ACL.UserNameRaw(User.Identity.GetUserId()) + " just posted something on their profile.", Url.Action("ViewProfile", new { id = ACL.UserNameRaw(User.Identity.GetUserId()) })); + return RedirectToAction("ViewProfile", "Profiles", new { id = ACL.UserNameRaw(User.Identity.GetUserId()) }); } -- cgit v1.2.3