Feat: Out of office autoresponder (#2992)

This change allows the user to enable autoresponder during the out-of-office time.

Fixes: #2035
This commit is contained in:
Aswin Dev P.S
2021-09-17 22:17:11 +05:30
committed by GitHub
parent 6ad5a7452c
commit 794a56d4cc
5 changed files with 68 additions and 26 deletions

View File

@@ -43,10 +43,10 @@ class WorkingHour < ApplicationRecord
def open_at?(time)
return false if closed_all_day?
time.hour >= open_hour &&
time.min >= open_minutes &&
time.hour <= close_hour &&
time.min <= close_minutes
open_time = Time.zone.now.in_time_zone(inbox.timezone).change({ hour: open_hour, min: open_minutes })
close_time = Time.zone.now.in_time_zone(inbox.timezone).change({ hour: close_hour, min: close_minutes })
time.between?(open_time, close_time)
end
def open_now?