mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
schedulemessages: Add handle_deferred_message() to handle requests.
This is responsible for: 1.) Handling all the incoming requests at the messages endpoint which have defer param set. This is similar to send_message_backend apart from the fact that instead of really sending a message it schedules one to be sent later on. 2.) Does some preliminary checks such as validating timestamp for scheduling a message, prevent scheduling a message in past, ensure correct format of message to be scheduled. 3.) Extracts time of scheduled delivery from message. 4.) Add tests for the newly introduced function. 5.) timezone: Add get_timezone() to obtain tz object from string. This helps in obtaining a timezone (tz) object from a timezone specified as a string. This string needs to be a pytz lib defined timezone string which we use to specify local timezones of the users.
This commit is contained in:
@@ -5,3 +5,6 @@ import pytz
|
||||
|
||||
def get_all_timezones() -> List[Text]:
|
||||
return sorted(pytz.all_timezones)
|
||||
|
||||
def get_timezone(tz: Text) -> pytz.datetime.tzinfo:
|
||||
return pytz.timezone(tz)
|
||||
|
||||
Reference in New Issue
Block a user