mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Better integration of groups conversations
This commit is contained in:
parent
0479a4d7a5
commit
b99c1e4a7f
@ -222,10 +222,13 @@ function log(message){
|
||||
* @param {number} id The ID of the conversation to open
|
||||
* @param {bool} fullscreen Specify whether the conversation has to
|
||||
* appear in full screen or not
|
||||
* @param {number} group_id Related group ID (if any)
|
||||
*/
|
||||
function openConversation(id, fullscreen = false){
|
||||
function openConversation(id, fullscreen = false, group_id){
|
||||
if(!fullscreen)
|
||||
ComunicWeb.components.conversations.manager.addConversation(id);
|
||||
else if (group_id)
|
||||
Page.openPage("groups/" + group_id + "/conversation/" + id);
|
||||
else
|
||||
openPage("conversations/" + id);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ const ConvChatWindow = {
|
||||
this.__conversationsCache["conversation-"+conversationID] = conversationInfos;
|
||||
|
||||
//Change the name of the conversation
|
||||
this.changeName(await getConvName(conv), conversationWindow);
|
||||
this.changeName(await getConvName(conv), conversationWindow, conv);
|
||||
|
||||
// Apply the color of the conversation (if any)
|
||||
if (conv.color)
|
||||
@ -395,9 +395,10 @@ const ConvChatWindow = {
|
||||
*
|
||||
* @param {String} newName The new name for the conversation window
|
||||
* @param {Ojbect} info Information about the conversation window
|
||||
* @param {Conversation} conv Conversation information (if available)
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
changeName: function(newName, info){
|
||||
changeName: function(newName, info, conv){
|
||||
|
||||
//Reduce new name
|
||||
if(newName.length > 18)
|
||||
@ -412,7 +413,7 @@ const ConvChatWindow = {
|
||||
appendTo: info.boxTitle,
|
||||
class: "fa fa-comments",
|
||||
ondblclick: () => {
|
||||
openConversation(info.conversationID, true);
|
||||
openConversation(info.conversationID, true, conv ? conv.group_id : null);
|
||||
info.closeFunction();
|
||||
}
|
||||
});
|
||||
@ -429,7 +430,7 @@ const ConvChatWindow = {
|
||||
/**
|
||||
* Update conversation members list
|
||||
*
|
||||
* @param {Object} conv Information about the conversation
|
||||
* @param {Object} info Information about the conversation
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
updateMembersList: function(info) {
|
||||
@ -544,6 +545,9 @@ const ConvChatWindow = {
|
||||
innerHTML: (member.is_admin ? tr("Admin") : tr("Member")) + " "
|
||||
});
|
||||
|
||||
if (conv.group_id)
|
||||
continue;
|
||||
|
||||
|
||||
// Set / unset admin
|
||||
if(canRemoveUsers && member.user_id != userID()) {
|
||||
@ -716,6 +720,19 @@ const ConvChatWindow = {
|
||||
settingsForm.allowEveryoneToAddMembers.parentNode.parentNode.remove();
|
||||
}
|
||||
|
||||
// It is not possible to update conversation info in managed conversations
|
||||
if (conversation.infos.group_id) {
|
||||
settingsForm.allowEveryoneToAddMembers.parentNode.parentNode.remove();
|
||||
|
||||
createElem2({
|
||||
type: "a",
|
||||
class: "a",
|
||||
insertBefore: settingsForm.rootElem.children[0],
|
||||
innerHTML: "This conversation is managed by a group",
|
||||
onclick: () => openPage("groups/" + conversation.infos.group_id)
|
||||
})
|
||||
}
|
||||
|
||||
//Update follow conversation checkbox status
|
||||
$(settingsForm.followConversationInput).iCheck(conversation.infos.members.find(m => m.user_id == userID()).following ? "check" : "uncheck");
|
||||
|
||||
|
@ -600,12 +600,7 @@ const SidebarMain = {
|
||||
let a = createElem2({
|
||||
appendTo: li,
|
||||
type: "a",
|
||||
onclick: () => {
|
||||
if (!conv.group_id)
|
||||
openConversation(conv.id, true)
|
||||
else
|
||||
Page.openPage("groups/" + conv.group_id + "/conversation/" + conv.id);
|
||||
}
|
||||
onclick: () => openConversation(conv.id, true, conv.group_id)
|
||||
});
|
||||
|
||||
// Icon
|
||||
|
Loading…
Reference in New Issue
Block a user