mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Add virtual directory support for sidebar
This commit is contained in:
parent
01d244386f
commit
1596fda533
@ -17,6 +17,10 @@ class Group {
|
||||
this.virtual_directory = info.virtual_directory;
|
||||
this.visibility = info.visibility;
|
||||
}
|
||||
|
||||
get hasVirtualDirectory() {
|
||||
return this.virtual_directory;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupsList {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user