1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Add locked and displayName to public-groups.json.

This commit is contained in:
Juliusz Chroboczek 2021-07-16 19:58:20 +02:00
parent 52a26327d7
commit eedfaccaff
2 changed files with 8 additions and 2 deletions

View file

@ -949,7 +949,9 @@ func (desc *Description) GetPermission(group string, c Challengeable) (ClientPer
type Public struct { type Public struct {
Name string `json:"name"` Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Locked bool `json:"locked,omitempty"`
ClientCount int `json:"clientCount"` ClientCount int `json:"clientCount"`
} }
@ -957,9 +959,12 @@ func GetPublic() []Public {
gs := make([]Public, 0) gs := make([]Public, 0)
Range(func(g *Group) bool { Range(func(g *Group) bool {
if g.Public() { if g.Public() {
locked, _ := g.Locked()
gs = append(gs, Public{ gs = append(gs, Public{
Name: g.name, Name: g.name,
DisplayName: g.DisplayName(),
Description: g.description.Description, Description: g.description.Description,
Locked: locked,
ClientCount: len(g.clients), ClientCount: len(g.clients),
}) })
} }

View file

@ -60,7 +60,7 @@ async function listPublicGroups() {
let td = document.createElement('td'); let td = document.createElement('td');
let a = document.createElement('a'); let a = document.createElement('a');
a.textContent = group.name; a.textContent = group.name;
a.href = '/group/' + encodeURIComponent(group.name); a.href = '/group/' + encodeURIComponent(group.displayName || group.name);
td.appendChild(a); td.appendChild(a);
tr.appendChild(td); tr.appendChild(td);
let td2 = document.createElement('td'); let td2 = document.createElement('td');
@ -68,7 +68,8 @@ async function listPublicGroups() {
td2.textContent = group.description; td2.textContent = group.description;
tr.appendChild(td2); tr.appendChild(td2);
let td3 = document.createElement('td'); let td3 = document.createElement('td');
td3.textContent = `(${group.clientCount} clients)`; let locked = group.locked ? ', locked' : '';
td3.textContent = `(${group.clientCount} clients${locked})`;
tr.appendChild(td3); tr.appendChild(td3);
table.appendChild(tr); table.appendChild(tr);
} }