diff --git a/assets/js/pages/conversations/conversation.js b/assets/js/pages/conversations/conversation.js index b4d42def..5fc4f930 100644 --- a/assets/js/pages/conversations/conversation.js +++ b/assets/js/pages/conversations/conversation.js @@ -146,7 +146,7 @@ const ConversationPageConvPart = { // Apply the list of messages ConversationPageConvPart.applyMessages(list) - // Automatically unregister conversations when it becoms required + // Automatically unregister conversations when it becomes required let reg = true; document.addEventListener("changeURI", async () => { if(reg) { diff --git a/assets/js/pages/groups/main.js b/assets/js/pages/groups/main.js index 24048624..a3961073 100644 --- a/assets/js/pages/groups/main.js +++ b/assets/js/pages/groups/main.js @@ -48,6 +48,7 @@ const GroupsPage = { //Else determine which group page to open (specified after the ID of the group) var groupID = page; + let firstArg; if(!args.subfolder || args.subfolder.split("/").length < 2){ page = "posts"; } @@ -55,6 +56,9 @@ const GroupsPage = { //Extract the page to open from the URL page = args.subfolder.split("/")[1]; + if (args.subfolder.split("/").length == 3) + firstArg = args.subfolder.split("/")[2]; + //Check if there is nothing after "/" if(page.length < 2) page = "posts"; @@ -88,7 +92,7 @@ const GroupsPage = { GroupSectionHeader.display(group, target); // Display the tabs of the group - await GroupTabs.show(group, target, page); + await GroupTabs.show(group, target, page, firstArg); switch(page) { @@ -107,6 +111,14 @@ const GroupsPage = { case "settings": await GroupSettingsPage.display(group.id, target); return; + + case "conversation": + let conv = group.conversations.find(c => c.id == firstArg); + + if (conv) { + GroupConversationPage.show(conv, target) + return; + } default: ComunicWeb.common.error.pageNotFound(null, target); diff --git a/assets/js/pages/groups/pages/conversation.js b/assets/js/pages/groups/pages/conversation.js new file mode 100644 index 00000000..2a3cb9fd --- /dev/null +++ b/assets/js/pages/groups/pages/conversation.js @@ -0,0 +1,19 @@ +/** + * Group conversation page + * + * @author Pierre Hubert + */ + +const GroupConversationPage = { + + /** + * Show a group conversation page + * + * @param {Conversation} conv Information about the target conversation + * @param {HTMLElement} target Target page + */ + show: function(conv, target) { + ConversationPageConvPart.open(conv.id, target) + } + +} \ No newline at end of file diff --git a/assets/js/pages/groups/pages/settings.js b/assets/js/pages/groups/pages/settings.js index 36d3a85c..55058e91 100644 --- a/assets/js/pages/groups/pages/settings.js +++ b/assets/js/pages/groups/pages/settings.js @@ -47,7 +47,7 @@ const GroupSettingsPage = { //Create form container var formContainer = createElem2({ - //TODO : remove comment appendTo: settingsBox, + appendTo: settingsBox, type: "div", class: "group-settings-form" }); diff --git a/assets/js/pages/groups/sections/tabs.js b/assets/js/pages/groups/sections/tabs.js index 13995cbd..dc3c427a 100644 --- a/assets/js/pages/groups/sections/tabs.js +++ b/assets/js/pages/groups/sections/tabs.js @@ -10,8 +10,9 @@ const GroupTabs = { * @param {AdvancedGroupInfo} group Group information * @param {HTMLElement} target Target * @param {String} activePage Current active page + * @param {String} firstArg First argument passed after page (if any) */ - show: async function(group, target, activePage) { + show: async function(group, target, activePage, firstArgument) { // Load template const tpl = await Page.loadHTMLTemplate("pages/groups/sections/GroupTabs.html"); const el = document.createElement("div") @@ -24,7 +25,9 @@ const GroupTabs = { return { isAdmin: group.membership == "administrator", canSeeMembers: group.is_members_list_public || group.membership == "administrator" || group.membership == "moderator", - activePage: activePage + activePage: activePage, + firstArgument: firstArgument, + conversations: group.conversations, } }, diff --git a/assets/templates/pages/groups/sections/GroupTabs.html b/assets/templates/pages/groups/sections/GroupTabs.html index abf43ebb..871b6027 100644 --- a/assets/templates/pages/groups/sections/GroupTabs.html +++ b/assets/templates/pages/groups/sections/GroupTabs.html @@ -1,12 +1,23 @@ -