Skip to content

Commit

Permalink
fix(outlook): adjust outlook config (#230)
Browse files Browse the repository at this point in the history
* fix(outlook): adjust outlook config

* test(outlook): remove focus
  • Loading branch information
chillfox authored Oct 20, 2022
1 parent 80ecf38 commit b65c7a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
14 changes: 8 additions & 6 deletions src/controllers/outlook.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ class Outlook < ActionController::Base
render :bad_request, json: "Outlook not configured" unless outlook_config = tenant.outlook_config
render :bad_request, json: "Missing app_id" if outlook_config.app_id.blank?

base_path = outlook_config.base_path || "outlook"

manifest = OutlookManifest.new(
app_id: outlook_config.app_id,
app_domain: outlook_config.app_domain || "https://#{tenant.domain}/outlook/",
app_domain: outlook_config.app_domain || "https://#{tenant.domain}/#{base_path}/",
app_resource: outlook_config.app_resource || "api://#{tenant.domain}/#{outlook_config.app_id}",
source_location: outlook_config.source_location || "https://#{tenant.domain}/outlook/",
function_file_url: outlook_config.function_file_url || "https://#{tenant.domain}/outlook/function-file/function-file.html",
taskpane_url: outlook_config.taskpane_url || "https://#{tenant.domain}/outlook/#/book/meeting",
rooms_button_url: outlook_config.rooms_button_url || "https://#{tenant.domain}/outlook/#/upcoming",
desks_button_url: outlook_config.desks_button_url || "https://#{tenant.domain}/outlook/#/book/desks"
source_location: outlook_config.source_location || "https://#{tenant.domain}/#{base_path}/",
function_file_url: "https://#{tenant.domain}/#{base_path}/function-file/function-file.html",
taskpane_url: "https://#{tenant.domain}/#{base_path}/#/book/meeting",
rooms_button_url: "https://#{tenant.domain}/#{base_path}/#/upcoming",
desks_button_url: "https://#{tenant.domain}/#{base_path}/#/book/desks"
)

render xml: manifest.to_xml
Expand Down
18 changes: 6 additions & 12 deletions src/models/tenant/outlook_config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ class Tenant
include JSON::Serializable

property app_id : String = ""
property base_path : String?
property app_domain : String?
property app_resource : String?
property source_location : String?
property function_file_url : String?
property taskpane_url : String?
property rooms_button_url : String?
property desks_button_url : String?

def params
{
app_id: @app_id,
app_domain: @app_domain,
app_resource: @app_resource,
source_location: @source_location,
function_file_url: @function_file_url,
taskpane_url: @taskpane_url,
rooms_button_url: @rooms_button_url,
desks_button_url: @desks_button_url,
app_id: @app_id,
base_path: @base_path,
app_domain: @app_domain,
app_resource: @app_resource,
source_location: @source_location,
}
end

Expand Down

0 comments on commit b65c7a8

Please sign in to comment.