Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(outlook): adjust outlook config #230

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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