fix: fall back from invalid presence timezone
This commit is contained in:
@@ -78,8 +78,12 @@ export class DavePresence {
|
||||
const profile = this.profileStore?.getAgentProfile();
|
||||
if (!profile) return this._result(false, 'profile_missing');
|
||||
|
||||
const timezone = profile.timezone || this.fallbackTimezone;
|
||||
const clock = localClock(now, timezone);
|
||||
let timezone = profile.timezone || this.fallbackTimezone;
|
||||
let clock = localClock(now, timezone);
|
||||
if (!clock && timezone !== this.fallbackTimezone) {
|
||||
timezone = this.fallbackTimezone;
|
||||
clock = localClock(now, timezone);
|
||||
}
|
||||
if (!clock) return this._result(false, 'invalid_timezone');
|
||||
this._rollDay(clock.day);
|
||||
if (this.state.sentCount >= this.maxPerDay) return this._result(false, 'daily_limit');
|
||||
|
||||
Reference in New Issue
Block a user