timeLimitsManager: Reset screen time if daily limit is changed

If the limit for the day had already been reached, the
`timeLimitsManager` was not resetting the screen time state if the daily
limit setting was then changed (and increased).

Fix that, and add a unit test for it.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8164
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3603>
This commit is contained in:
Philip Withnall
2025-01-20 13:33:20 +00:00
committed by Marge Bot
parent 1471733dfd
commit c890a2f1e3
2 changed files with 38 additions and 0 deletions

View File

@ -666,6 +666,8 @@ export const TimeLimitsManager = GObject.registerClass({
// Schedule an update for when the limit will be reset again.
this._scheduleUpdateState(startOfTomorrowSecs - nowSecs);
} else if (this._userState === UserState.ACTIVE) {
newState = TimeLimitsState.ACTIVE;
// Schedule an update for when we expect the limit will be reached.
this._scheduleUpdateState(dailyLimitSecs - activeTimeTodaySecs);
} else {