diff --git a/assets/js/components/groups/GroupsList.js b/assets/js/components/groups/GroupsList.js index dd162853..889912e7 100644 --- a/assets/js/components/groups/GroupsList.js +++ b/assets/js/components/groups/GroupsList.js @@ -17,6 +17,10 @@ class Group { this.virtual_directory = info.virtual_directory; this.visibility = info.visibility; } + + get hasVirtualDirectory() { + return this.virtual_directory; + } } class GroupsList { diff --git a/assets/js/components/sidebar/main.js b/assets/js/components/sidebar/main.js index 4511841e..e3489288 100644 --- a/assets/js/components/sidebar/main.js +++ b/assets/js/components/sidebar/main.js @@ -368,7 +368,7 @@ const SidebarMain = { * * @param {HTMLElement} target * @param {*} friend - * @param {*} user + * @param {User} user */ applyFriend: function(target, friend, user) { @@ -378,6 +378,9 @@ const SidebarMain = { }); li.setAttribute("data-membership-user-id", user.id) + if(user.hasVirtualDirectory) + li.setAttribute("data-membership-dir", user.virtualDirectory) + let a = createElem2({ appendTo: li, @@ -467,7 +470,7 @@ const SidebarMain = { * Apply group information * * @param {HTMLElement} target - * @param {*} group + * @param {Group} group * @param {*} lastactive */ applyGroup: function(target, group, lastactive) { @@ -478,6 +481,9 @@ const SidebarMain = { }); li.setAttribute("data-membership-group-id", group.id) + if(group.hasVirtualDirectory) + li.setAttribute("data-membership-dir", group.virtual_directory) + let a = createElem2({ appendTo: li, type: "a", @@ -591,14 +597,17 @@ const SidebarMain = { query = "[data-membership-user-id=\""+currPage.split("/")[1].split("#")[0]+"\"]" // Groups - if(currPage.startsWith("groups/")) + else if(currPage.startsWith("groups/")) query = "[data-membership-group-id=\""+currPage.split("/")[1].split("#")[0]+"\"]" // Conversations - if(currPage.startsWith("conversations/")) + else if(currPage.startsWith("conversations/")) query = "[data-membership-conv-id=\""+currPage.split("/")[1].split("#")[0]+"\"]" - + // Search by virtual directory + else { + query = "[data-membership-dir=\""+currPage.split("/")[0].split("?")[0].split("#")[0]+"\"]"; + } // Query element diff --git a/assets/js/user/usersList.js b/assets/js/user/usersList.js index 4b4bf57c..d51b45c4 100644 --- a/assets/js/user/usersList.js +++ b/assets/js/user/usersList.js @@ -20,12 +20,26 @@ class User { this.id = info.userID; } + /** + * Backward compatibility + */ + get userID() { + return this.id + } + /** * Get the full name of the user */ get fullName() { return this.firstName + " " + this.lastName; } + + /** + * Check out whether a given user has a virtual directory or not + */ + get hasVirtualDirectory() { + return this.virtualDirectory; + } } class UsersList {