Commit 249c1c11 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Don't notify clients when description is unchanged.

When we fixed the handling of autolocked groups, we introduced
a bug where we spuriously notify clients even when the description
didn't change.
parent 8a2357de
...@@ -438,9 +438,11 @@ func add(name string, desc *Description) (*Group, []Client, error) { ...@@ -438,9 +438,11 @@ func add(name string, desc *Description) (*Group, []Client, error) {
g.mu.Lock() g.mu.Lock()
defer g.mu.Unlock() defer g.mu.Unlock()
notify := false
if desc != nil { if desc != nil {
if !descriptionMatch(g.description, desc) { if !descriptionMatch(g.description, desc) {
g.description = desc g.description = desc
notify = true
} }
} else if !descriptionUnchanged(name, g.description) { } else if !descriptionUnchanged(name, g.description) {
desc, err = readDescription(name) desc, err = readDescription(name)
...@@ -452,11 +454,16 @@ func add(name string, desc *Description) (*Group, []Client, error) { ...@@ -452,11 +454,16 @@ func add(name string, desc *Description) (*Group, []Client, error) {
return nil, nil, err return nil, nil, err
} }
g.description = desc g.description = desc
notify = true
} }
autoLockKick(g) autoLockKick(g)
return g, g.getClientsUnlocked(nil), nil var clients []Client
if notify {
clients = g.getClientsUnlocked(nil)
}
return g, clients, nil
} }
func Range(f func(g *Group) bool) { func Range(f func(g *Group) bool) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment