Can respond to group invitation from sidebar

This commit is contained in:
Pierre HUBERT 2021-03-15 16:43:40 +01:00
parent d61d8d977c
commit d0812e2d85
3 changed files with 40 additions and 3 deletions

View File

@ -104,6 +104,17 @@ body.sidebar-collapse .main-sidebar .memberships-list li:hover .subinfo {
}
.main-sidebar .memberships-list .btn-xs {
padding-top: 0px;
padding-bottom: 0px;
height: 1.35em;
width: 3em;
line-height: 1;
display: inline-flex;
align-items: center;
justify-content: center;
}
/**
* Conversations entries
*/

View File

@ -4,7 +4,7 @@
* @author Pierre HUBERT
*/
ComunicWeb.components.groups.interface = {
const GroupsInterface = {
/**
* Create a group
@ -373,4 +373,6 @@ ComunicWeb.components.groups.interface = {
};
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
}
};
};
ComunicWeb.components.groups.interface = GroupsInterface;

View File

@ -519,8 +519,32 @@ const SidebarMain = {
else if(group.membership == "invited") {
// Show invited state
subInfoEl.innerHTML = "<i class='fa fa-question'></i> Invited";
subInfoEl.innerHTML = "<i class='fa fa-question'></i> Invited ";
const respondRequest = (accept) => {
GroupsInterface.respondInvitation(group.id, accept);
subInfoEl.innerHTML = accept ? tr("Accepted") : tr("Rejected");
};
// Offer the user to accept or reject the invitation
createElem2({
appendTo: subInfoEl,
type: "span",
class: "btn btn-success btn-xs",
innerHTML: "<i class='fa fa-check'></i>",
onclick: (e) => respondRequest(true)
});
add_space(subInfoEl);
createElem2({
appendTo: subInfoEl,
type: "span",
class: "btn btn-danger btn-xs",
innerHTML: "<i class='fa fa-close'></i>",
onclick: (e) => respondRequest(false)
});
}
else
// Group last activity