Send global root_account_id to Kaltura in partner_data

Will allow proper differentiation of media in Kaltura in the future.

There are two ways that partner_data makes it up to Kaltura:

 (1) via a bulk_upload of attachments in the backend
 (2) via the rich text editor upload/record video button

For (1), we globalize the id in KalturaMediaFileHandler. For (2) we
move the domain_root_account_id to js_env as we globalize it.

fixes CNVS-14870

Test Plan

(requires a dev with db access to kaltura to check partner_data)

Kaltura should receive partner_data that includes a global
root_account_id in all of the following contexts:

 - upload a video via RTE
 - record a video via RTE
 - upload a file and add it to a document

Change-Id: Ia4e96ee555465d447015e4cf7a7508e093e51ec2
Reviewed-on: https://gerrit.instructure.com/39496
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Paul Hinze <paulh@instructure.com>
This commit is contained in:
Paul Hinze 2014-08-18 15:02:48 -05:00
parent 49af2abd45
commit 1277fcea73
6 changed files with 15 additions and 4 deletions

View File

@ -105,6 +105,7 @@ class ApplicationController < ActionController::Base
:current_user_roles => @current_user.try(:roles),
:AUTHENTICITY_TOKEN => form_authenticity_token,
:files_domain => HostUrl.file_host(@domain_root_account || Account.default, request.host_with_port),
:DOMAIN_ROOT_ACCOUNT_ID => @domain_root_account.try(:global_id),
}
@js_env[:lolcalize] = true if ENV['LOLCALIZE']
end

View File

@ -58,7 +58,7 @@ class KalturaMediaFileHandler
partner_data.merge({
attachment_id: attachment.id.to_s,
context_source: "file_upload",
root_account_id: attachment.root_account_id.to_s,
root_account_id: Shard.global_id_for(attachment.root_account_id).to_s,
}).to_json
end

View File

@ -227,7 +227,6 @@
<a href="<%= page_view_path(@page_view.id || @page_view.temporary_id) %>" id="page_view_update_path">&nbsp;</a>
<div id="page_view_id"><%= @page_view.id || @page_view.temporary_id %></div>
<% end %>
<div id="domain_root_account_id"><%= @domain_root_account.try(:id) %></div>
<% if equella_enabled? %>
<a id="equella_endpoint_url" href="<%= @equella_settings.endpoint %>">&nbsp;</a>
<a id="equella_callback_url" href="<%= external_content_success_url('equella') %>">&nbsp;</a>

View File

@ -42,7 +42,7 @@ define([
$.mediaComment.partnerData = function(params) {
var hash = {
context_code: $.mediaComment.contextCode(),
root_account_id: domainRootAccountId || (domainRootAccountId = Number($("#domain_root_account_id").text())),
root_account_id: ENV.DOMAIN_ROOT_ACCOUNT_ID,
context_source: ENV.CONTEXT_ACTION_SOURCE
}
if(ENV.SIS_SOURCE_ID){

View File

@ -158,6 +158,15 @@ describe ApplicationController do
controller.js_env :REAL_SLIM_SHADY => 'please stand up'
expect { controller.js_env(:REAL_SLIM_SHADY => 'poser') }.to raise_error
end
context "sharding" do
specs_require_sharding
it "should set the global id for the domain_root_account" do
controller.instance_variable_set(:@domain_root_account, Account.default)
controller.js_env[:DOMAIN_ROOT_ACCOUNT_ID].should == Account.default.global_id
end
end
end
describe "clean_return_to" do

View File

@ -84,6 +84,8 @@ describe KalturaMediaFileHandler do
end
context "partner_data" do
specs_require_sharding
it "always includes basic info about attachment and context" do
KalturaMediaFileHandler.new.add_media_files([attachment], wait_for_completion)
@ -91,7 +93,7 @@ describe KalturaMediaFileHandler do
partner_data_json.should == {
"attachment_id" => attachment.id.to_s,
"context_source" => "file_upload",
"root_account_id" => attachment.root_account_id.to_s,
"root_account_id" => Shard.global_id_for(attachment.root_account_id).to_s,
}
end