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/ForumController.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Project-Unite/Controllers/ForumController.cs') diff --git a/Project-Unite/Controllers/ForumController.cs b/Project-Unite/Controllers/ForumController.cs index 9e3275a..f64bcfb 100644 --- a/Project-Unite/Controllers/ForumController.cs +++ b/Project-Unite/Controllers/ForumController.cs @@ -223,6 +223,8 @@ namespace Project_Unite.Controllers post.PostedAt = DateTime.Now; db.ForumPosts.Add(post); db.SaveChanges(); + NotificationDaemon.NotifyFollowers(User.Identity.GetUserId(), "New post from " + ACL.UserNameRaw(User.Identity.GetUserId()) + "!", ACL.UserNameRaw(User.Identity.GetUserId()) + " just posted a reply to " + topic.Subject + ".", Url.Action("ViewTopic", new { id = topic.Discriminator })); + NotificationDaemon.NotifyUser(User.Identity.GetUserId(), topic.AuthorId, "New post from " + ACL.UserNameRaw(User.Identity.GetUserId()) + "!", ACL.UserNameRaw(User.Identity.GetUserId()) + " just posted a reply to " + topic.Subject + ".", Url.Action("ViewTopic", new { id = topic.Discriminator })); return RedirectToAction("ViewTopic", new { id = topic.Discriminator }); @@ -292,6 +294,7 @@ namespace Project_Unite.Controllers db.ForumTopics.Add(topic); db.ForumPosts.Add(post); db.SaveChanges(); + NotificationDaemon.NotifyFollowers(User.Identity.GetUserId(), "New topic started by " + ACL.UserNameRaw(User.Identity.GetUserId()) + "!", ACL.UserNameRaw(User.Identity.GetUserId()) + " just started a topic: " + topic.Subject + ".", Url.Action("ViewTopic", new { id = topic.Discriminator })); return RedirectToAction("ViewTopic", new { id = topic.Discriminator }); -- cgit v1.2.3