Fix updating feature flags

This commit is contained in:
Daniel
2023-08-07 21:54:58 +02:00
parent 95705c7ecf
commit 2a41240212
3 changed files with 8 additions and 4 deletions

View File

@@ -587,8 +587,10 @@ func (conn *Connection) UpdateFeatures() error {
if err != nil && !errors.Is(err, access.ErrNotLoggedIn) {
return err
}
// Caution: user may be nil!
// Check if history may be used and if it is enabled for this application.
conn.HistoryEnabled = false
if user.MayUse(account.FeatureHistory) {
lProfile := conn.Process().Profile()
if lProfile != nil {
@@ -597,9 +599,7 @@ func (conn *Connection) UpdateFeatures() error {
}
// Check if bandwidth visibility may be used.
if user.MayUse(account.FeatureBWVis) {
conn.BandwidthEnabled = true
}
conn.BandwidthEnabled = user.MayUse(account.FeatureBWVis)
return nil
}