mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
Merge pull request #1955 from slingamn/history_privs
exempt operators from history cutoffs
This commit is contained in:
commit
d6d5bbe27b
@ -972,25 +972,28 @@ func (server *Server) GetHistorySequence(providedChannel *Channel, client *Clien
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cutoff time.Time
|
var cutoff time.Time
|
||||||
if config.History.Restrictions.ExpireTime != 0 {
|
// #1593: cutoff is ignored for operators
|
||||||
cutoff = time.Now().UTC().Add(-time.Duration(config.History.Restrictions.ExpireTime))
|
if !client.HasRoleCapabs("history") {
|
||||||
}
|
if config.History.Restrictions.ExpireTime != 0 {
|
||||||
// #836: registration date cutoff is always enforced for DMs
|
cutoff = time.Now().UTC().Add(-time.Duration(config.History.Restrictions.ExpireTime))
|
||||||
// either way, take the later of the two cutoffs
|
|
||||||
if restriction == HistoryCutoffRegistrationTime || channel == nil {
|
|
||||||
regCutoff := client.historyCutoff()
|
|
||||||
if regCutoff.After(cutoff) {
|
|
||||||
cutoff = regCutoff
|
|
||||||
}
|
}
|
||||||
} else if restriction == HistoryCutoffJoinTime {
|
// #836: registration date cutoff is always enforced for DMs
|
||||||
if joinTimeCutoff.After(cutoff) {
|
// either way, take the later of the two cutoffs
|
||||||
cutoff = joinTimeCutoff
|
if restriction == HistoryCutoffRegistrationTime || channel == nil {
|
||||||
|
regCutoff := client.historyCutoff()
|
||||||
|
if regCutoff.After(cutoff) {
|
||||||
|
cutoff = regCutoff
|
||||||
|
}
|
||||||
|
} else if restriction == HistoryCutoffJoinTime {
|
||||||
|
if joinTimeCutoff.After(cutoff) {
|
||||||
|
cutoff = joinTimeCutoff
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// #836 again: grace period is never applied to DMs
|
// #836 again: grace period is never applied to DMs
|
||||||
if !cutoff.IsZero() && channel != nil && restriction != HistoryCutoffJoinTime {
|
if !cutoff.IsZero() && channel != nil && restriction != HistoryCutoffJoinTime {
|
||||||
cutoff = cutoff.Add(-time.Duration(config.History.Restrictions.GracePeriod))
|
cutoff = cutoff.Add(-time.Duration(config.History.Restrictions.GracePeriod))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if hist != nil {
|
if hist != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user