1
Fork 0

Only send chat history when joining.

When we moved the chat history to the client goroutine back in 0.6,
we started sending the history whenever the group configuration changed.
Only send it when first joining the group.  Thanks to Rémi Nollet.
This commit is contained in:
Juliusz Chroboczek 2022-10-07 00:21:03 +02:00
parent 62517844a5
commit 8a2357de21
2 changed files with 22 additions and 13 deletions

View File

@ -2,6 +2,7 @@ Galene 0.6.1 (unreleased):
* Ensure that autolocked groups are locked on creation. Thanks to * Ensure that autolocked groups are locked on creation. Thanks to
Michael Ströder. Michael Ströder.
* Don't send chat history multiple times. Thanks to Rémy Nollet.
* Add a camera/microphone indicator in the users list. * Add a camera/microphone indicator in the users list.
* Hide audio-only peers by default. * Hide audio-only peers by default.

View File

@ -1168,8 +1168,9 @@ func handleAction(c *webClient, a interface{}) error {
case joinedAction: case joinedAction:
var status *group.Status var status *group.Status
var data map[string]interface{} var data map[string]interface{}
var g *group.Group
if a.group != "" { if a.group != "" {
g := group.Get(a.group) g = group.Get(a.group)
if g != nil { if g != nil {
s := g.Status(true, "") s := g.Status(true, "")
status = &s status = &s
@ -1190,7 +1191,13 @@ func handleAction(c *webClient, a interface{}) error {
if err != nil { if err != nil {
return err return err
} }
h := c.group.GetChatHistory() if a.kind == "join" {
if g == nil {
log.Println("g is null when joining" +
"this shouldn't happen")
return nil
}
h := g.GetChatHistory()
for _, m := range h { for _, m := range h {
err := c.write(clientMessage{ err := c.write(clientMessage{
Type: "chathistory", Type: "chathistory",
@ -1204,6 +1211,7 @@ func handleAction(c *webClient, a interface{}) error {
return err return err
} }
} }
}
case permissionsChangedAction: case permissionsChangedAction:
g := c.Group() g := c.Group()
if g == nil { if g == nil {