3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 00:19:29 +01:00

exempt operators from history cutoffs

See #1593; this enables a client-side implementation of bulk deletion
This commit is contained in:
Shivaram Lingamneni 2022-05-12 16:43:11 -04:00
parent dd75eb1084
commit 737697d1d4

View File

@ -972,6 +972,8 @@ func (server *Server) GetHistorySequence(providedChannel *Channel, client *Clien
}
var cutoff time.Time
// #1593: cutoff is ignored for operators
if !client.HasRoleCapabs("history") {
if config.History.Restrictions.ExpireTime != 0 {
cutoff = time.Now().UTC().Add(-time.Duration(config.History.Restrictions.ExpireTime))
}
@ -992,6 +994,7 @@ func (server *Server) GetHistorySequence(providedChannel *Channel, client *Clien
if !cutoff.IsZero() && channel != nil && restriction != HistoryCutoffJoinTime {
cutoff = cutoff.Add(-time.Duration(config.History.Restrictions.GracePeriod))
}
}
if hist != nil {
sequence = hist.MakeSequence(correspondent, cutoff)