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

@ -37,6 +37,20 @@ ComunicWeb.components.notifications.ui = {
message += "accepted your friendship request.";
if(data.type == "rejected_friend_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
if(data.type == "elem_created"){
@ -65,7 +79,9 @@ ComunicWeb.components.notifications.ui = {
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
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

View File

@ -44,6 +44,9 @@ ComunicWeb.components.notifications.utils = {
if(!groups.includes(notif.from_container_id) && notif.from_container_type == "group_page")
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);
});