From efe1ee5d7de3aa0ca1629b6eb8049b3d13724537 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 10 Mar 2018 07:56:56 -0600 Subject: [PATCH] VRFS-4721 - Links in lesson chat should not require you to log in when external browser shows --- .../react-components/ChatWindow.js.jsx.coffee | 16 +++++++++++++--- .../api_music_notations_controller.rb | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web/app/assets/javascripts/react-components/ChatWindow.js.jsx.coffee b/web/app/assets/javascripts/react-components/ChatWindow.js.jsx.coffee index 1dbf0a639..210959bed 100644 --- a/web/app/assets/javascripts/react-components/ChatWindow.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/ChatWindow.js.jsx.coffee @@ -52,13 +52,23 @@ SessionStore = @SessionStore notationClicked: (music_notation, e) -> e.preventDefault() - context.JK.popExternalLink("/api/music_notations/#{music_notation.id}?target=_blank") + rest.getMusicNotation(music_notation.id).done((response) => + context.JK.popExternalLink(response.url) + ) + .fail((jqXHR) => + context.JK.Banner.showAlert('Unable to fetch URL for music notation. Error: ' + jqXHR.responseText) + ) audioClicked: (music_notation, e) -> e.preventDefault() - context.JK.popExternalLink("/api/music_notations/#{music_notation.id}?target=_blank") - + rest.getMusicNotation(music_notation.id).done((response) => + context.JK.popExternalLink(response.url) + ) + .fail((jqXHR) => + context.JK.Banner.showAlert('Unable to fetch URL for audio. Error: ' + jqXHR.responseText) + ) + recordingClicked: (recording, e) -> e.preventDefault() context.JK.popExternalLink("/recordings/#{recording.id}") diff --git a/web/app/controllers/api_music_notations_controller.rb b/web/app/controllers/api_music_notations_controller.rb index 7ebd12932..1de842c12 100644 --- a/web/app/controllers/api_music_notations_controller.rb +++ b/web/app/controllers/api_music_notations_controller.rb @@ -72,7 +72,7 @@ class ApiMusicNotationsController < ApiController if '_blank'==params[:target] redirect_to @music_notation.sign_url else - render :text => @music_notation.sign_url + render :json => {url: @music_notation.sign_url} end end