Support group membership notifications

This commit is contained in:
Pierre HUBERT 2018-08-02 09:23:38 +02:00
parent 837bc35a6b
commit 04b80782dc
2 changed files with 31 additions and 1 deletions

View File

@ -38,6 +38,20 @@ ComunicWeb.components.notifications.ui = {
if(data.type == "rejected_friend_request") if(data.type == "rejected_friend_request")
message += "rejected your friendship request."; message += "rejected your friendship request.";
//About group membership
if(data.type == "sent_group_membership_invitation")
message += "invited you to join the group";
if(data.type == "accepted_group_membership_invitation")
message += "accepted his invitation to join the group";
if(data.type == "rejected_group_membership_invitation")
message += "rejected his invitation to join the group";
if(data.type == "sent_group_membership_request")
message += "sent a request to join the group";
if(data.type == "accepted_group_membership_request")
message += "accepted your request to join the group";
if(data.type == "rejected_group_membership_request")
message += "rejected your request to join the group";
//Generic element creation //Generic element creation
if(data.type == "elem_created"){ if(data.type == "elem_created"){
@ -65,7 +79,9 @@ ComunicWeb.components.notifications.ui = {
message += "on the group "+groups[data.from_container_id].name+"."; message += "on the group "+groups[data.from_container_id].name+".";
} }
//Group membership
if(data.on_elem_type == "group_membership")
message += groups[data.on_elem_id].name;
//Create notification action //Create notification action
var action = function(){ var action = function(){
@ -90,6 +106,17 @@ ComunicWeb.components.notifications.ui = {
} }
//For the group membership
if(data.on_elem_type == "group_membership"){
//Open appropriate page
if(data.type == "sent_group_membership_request")
openPage("groups/"+data.on_elem_id+"/members");
else
openGroupPage(groups[data.on_elem_id]);
}
}; };
//Create the notification object //Create the notification object

View File

@ -45,6 +45,9 @@ ComunicWeb.components.notifications.utils = {
if(!groups.includes(notif.from_container_id) && notif.from_container_type == "group_page") if(!groups.includes(notif.from_container_id) && notif.from_container_type == "group_page")
groups.push(notif.from_container_id); groups.push(notif.from_container_id);
if(!groups.includes(notif.on_elem_id) && notif.on_elem_type == "group_membership")
groups.push(notif.on_elem_id);
}); });
return groups; return groups;