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

Fix status generation for remote groups.

This commit is contained in:
Juliusz Chroboczek 2022-09-16 20:45:54 +02:00
parent 4f83de3335
commit bf142c41a0
2 changed files with 18 additions and 4 deletions

View file

@ -1185,8 +1185,9 @@ func (g *Group) GetPermission(creds ClientCredentials) (string, []string, error)
type Status struct { type Status struct {
Name string `json:"name"` Name string `json:"name"`
Location string `json:"location"` Redirect string `json:"redirect,omitempty"`
Endpoint string `json:"endpoint"` Location string `json:"location,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
DisplayName string `json:"displayName,omitempty"` DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
AuthServer string `json:"authServer,omitempty"` AuthServer string `json:"authServer,omitempty"`
@ -1201,6 +1202,15 @@ type Status struct {
func (g *Group) Status(authentified bool, base string) Status { func (g *Group) Status(authentified bool, base string) Status {
desc := g.Description() desc := g.Description()
if desc.Redirect != "" {
return Status{
Name: g.name,
Redirect: desc.Redirect,
DisplayName: desc.DisplayName,
Description: desc.Description,
}
}
var location, endpoint string var location, endpoint string
if base != "" { if base != "" {
burl, err := url.Parse(base) burl, err := url.Parse(base)

View file

@ -119,8 +119,12 @@ 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');
if(!group.redirect) {
let locked = group.locked ? ', locked' : ''; let locked = group.locked ? ', locked' : '';
td3.textContent = `(${group.clientCount} clients${locked})`; td3.textContent = `(${group.clientCount} clients${locked})`;
} else {
td3.textContent = '(remote)';
}
tr.appendChild(td3); tr.appendChild(td3);
table.appendChild(tr); table.appendChild(tr);
} }