From a5ab20aa1b81b8d8611133fc7ce77b5817d70f37 Mon Sep 17 00:00:00 2001 From: William Le Date: Wed, 20 Sep 2023 23:16:18 -0700 Subject: [PATCH 1/3] feat(placeos/room-events): add list_users func --- drivers/place/bookings.cr | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/place/bookings.cr b/drivers/place/bookings.cr index 8ce814e102..9004cdf969 100644 --- a/drivers/place/bookings.cr +++ b/drivers/place/bookings.cr @@ -43,6 +43,7 @@ class Place::Bookings < PlaceOS::Driver hide_meeting_details: false, hide_meeting_title: false, enable_end_meeting_button: false, + max_user_search_results: 20, # use this to expose arbitrary fields to influx # expose_for_analytics: {"binding" => "key->subkey"}, @@ -67,6 +68,7 @@ class Place::Bookings < PlaceOS::Driver @include_cancelled_bookings : Bool = false @application_permissions : Bool = false @disable_book_now_host : Bool = false + @max_user_search_results : UInt32 = 20 @current_meeting_id : String = "" @current_pending : Bool = false @@ -106,6 +108,7 @@ class Place::Bookings < PlaceOS::Driver @disable_book_now = book_now.nil? ? !bookable : !!book_now @disable_end_meeting = !!setting?(Bool, :disable_end_meeting) @disable_book_now_host = setting?(Bool, :disable_book_now_host) || false + @max_user_search_results = setting?(UInt32, :max_user_search_results) || 20_u32 pending_period = setting?(UInt32, :pending_period) || 5_u32 @pending_period = pending_period.minutes @@ -208,6 +211,11 @@ class Place::Bookings < PlaceOS::Driver schedule.in(1.seconds) { poll_events } unless (subscription = @subscription) && !subscription.expired? end + # Allow apps to search for attendees (to add to new bookings) via driver instead of via staff-api (as some role based accounts may not have MS Graph access) + def list_users(query : String? = nil, limit : UInt32? = 20_u32) + calendar.list_users(query, limit).get.as_a + end + def book_now(period_in_seconds : Int64, title : String? = nil, owner : String? = nil) title ||= @default_title starting = Time.utc.to_unix From 87129a103f0f6f2eece2e22fb04a1ecec07af8d2 Mon Sep 17 00:00:00 2001 From: William Le Date: Wed, 20 Sep 2023 23:29:43 -0700 Subject: [PATCH 2/3] style(placeos/room-events): format --- drivers/place/bookings.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/place/bookings.cr b/drivers/place/bookings.cr index 9004cdf969..edbff1f926 100644 --- a/drivers/place/bookings.cr +++ b/drivers/place/bookings.cr @@ -40,10 +40,10 @@ class Place::Bookings < PlaceOS::Driver room_image: "https://domain.com/room_image.svg", sensor_mac: "device-mac", - hide_meeting_details: false, - hide_meeting_title: false, + hide_meeting_details: false, + hide_meeting_title: false, enable_end_meeting_button: false, - max_user_search_results: 20, + max_user_search_results: 20, # use this to expose arbitrary fields to influx # expose_for_analytics: {"binding" => "key->subkey"}, From 046b28de0c0b14770d4cdd64bc56f4d171eeff7e Mon Sep 17 00:00:00 2001 From: William Le Date: Thu, 21 Sep 2023 23:04:50 -0700 Subject: [PATCH 3/3] chore(placeos/room-events): don't parse calendar resp internally Co-authored-by: Stephen von Takach --- drivers/place/bookings.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/place/bookings.cr b/drivers/place/bookings.cr index edbff1f926..c4e77b4eac 100644 --- a/drivers/place/bookings.cr +++ b/drivers/place/bookings.cr @@ -213,7 +213,7 @@ class Place::Bookings < PlaceOS::Driver # Allow apps to search for attendees (to add to new bookings) via driver instead of via staff-api (as some role based accounts may not have MS Graph access) def list_users(query : String? = nil, limit : UInt32? = 20_u32) - calendar.list_users(query, limit).get.as_a + calendar.list_users(query, limit) end def book_now(period_in_seconds : Int64, title : String? = nil, owner : String? = nil)