* fix #2133

Don't record NICK and QUIT in history for invisible auditorium members
This commit is contained in:
Shivaram Lingamneni 2024-03-17 11:42:39 -04:00 committed by GitHub
parent 681e8b1292
commit 8d082865da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 4 deletions

View file

@ -1297,10 +1297,10 @@ func (client *Client) destroy(session *Session) {
}
var quitItem history.Item
var channels []*Channel
var quitHistoryChannels []*Channel
// use a defer here to avoid writing to mysql while holding the destroy semaphore:
defer func() {
for _, channel := range channels {
for _, channel := range quitHistoryChannels {
channel.AddHistoryItem(quitItem, details.account)
}
}()
@ -1322,8 +1322,11 @@ func (client *Client) destroy(session *Session) {
// clean up channels
// (note that if this is a reattach, client has no channels and therefore no friends)
friends := make(ClientSet)
channels = client.Channels()
channels := client.Channels()
for _, channel := range channels {
if channel.memberIsVisible(client) {
quitHistoryChannels = append(quitHistoryChannels, channel)
}
for _, member := range channel.auditoriumFriends(client) {
friends.Add(member)
}