summaryrefslogtreecommitdiff
path: root/Project-Unite/Controllers
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-24 15:54:53 -0400
committerMichael <[email protected]>2017-03-24 15:54:53 -0400
commitcd73cc80d1c097e584938ffe993bd546bab9d31a (patch)
tree215c148073933b0ee061cb6fa528ba081efa733a /Project-Unite/Controllers
parentc29c1366213c06503e875e43ed251a1d96003acb (diff)
downloadproject-unite-cd73cc80d1c097e584938ffe993bd546bab9d31a.tar.gz
project-unite-cd73cc80d1c097e584938ffe993bd546bab9d31a.tar.bz2
project-unite-cd73cc80d1c097e584938ffe993bd546bab9d31a.zip
Notification daemon works.
You now get notifications when someone you follow makes a post - or when a user replies to a topic you made.
Diffstat (limited to 'Project-Unite/Controllers')
-rw-r--r--Project-Unite/Controllers/ForumController.cs3
-rw-r--r--Project-Unite/Controllers/ProfilesController.cs5
2 files changed, 7 insertions, 1 deletions
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 });
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()) });
}