3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-10-06 18:47:24 +02:00

Merge pull request #1955 from slingamn/history_privs

exempt operators from history cutoffs
This commit is contained in:
Shivaram Lingamneni 2022-05-13 02:04:56 -04:00 committed by GitHub
commit d6d5bbe27b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)