From 9ff2ab2452db74cfb8d28a9bbc3eb481fc6a2a04 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 3 Mar 2018 14:39:48 +0100 Subject: [PATCH] Can display friendship request notifications --- assets/js/components/notifications/ui.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/assets/js/components/notifications/ui.js b/assets/js/components/notifications/ui.js index 7d346d79..621a4f52 100644 --- a/assets/js/components/notifications/ui.js +++ b/assets/js/components/notifications/ui.js @@ -25,15 +25,27 @@ ComunicWeb.components.notifications.ui = { var message = userFullName(from_user) + " "; //Notification action + //Comment if(data.type == "comment_created") message += "posted a comment"; + //About friendship requests + if(data.type == "sent_friend_request") + message += "sent you a friendship request."; + if(data.type == "accepted_friend_request") + message += "accepted your friendship request."; + if(data.type == "rejected_friend_request") + message += "rejected your friendship request."; + + //Generic element creation if(data.type == "elem_created"){ if(data.on_elem_type == "post") message += "created a new post"; } + + //Space separator message += " "; //Notification target @@ -57,13 +69,22 @@ ComunicWeb.components.notifications.ui = { ComunicWeb.components.notifications.interface.mark_seen(data.id, true); //Process specific action - if(data.on_elem_type = "post"){ + //For the post + if(data.on_elem_type == "post"){ //Open associated post page openPage("post/" + data.on_elem_id); } + //For the friendship requests + if(data.on_elem_type == "friend_request"){ + + //Open user page + openUserPage(data.from_user_id); + + } + }; //Create the notification object