From ed2e37394e0bdbd20791c759e033bcb3e6cc4d2c Mon Sep 17 00:00:00 2001 From: enahum Date: Fri, 20 May 2016 12:55:52 -0300 Subject: PLT 783 Fix Previews for removed YouTube videos (#3073) * PLT-783 Fix Previews for removed YouTube videos render incorrectly and throw a 404 * Updating video poster for video not found (#3072) --- webapp/utils/utils.jsx | 2 +- webapp/utils/web_client.jsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'webapp/utils') diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 596b1ae06..e2ca06837 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -682,7 +682,7 @@ export function applyTheme(theme) { changeCss('.app__body .post-list__arrows', 'fill:' + changeOpacity(theme.centerChannelColor, 0.3), 1); changeCss('.app__body .sidebar--left, .app__body .sidebar--right .sidebar--right__header, .app__body .suggestion-list__content .command', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.app__body .app__content, .app__body .post-create__container .post-create-body .btn-file, .app__body .post-create__container .post-create-footer .msg-typing, .app__body .suggestion-list__content .command, .app__body .modal .modal-content, .app__body .dropdown-menu, .app__body .popover, .app__body .mentions__name, .app__body .tip-overlay', 'color:' + theme.centerChannelColor, 1); - changeCss('.app__body #archive-link-home', 'background:' + changeOpacity(theme.centerChannelColor, 0.15), 1); + changeCss('.app__body #archive-link-home, .video-div .video-thumbnail__error', 'background:' + changeOpacity(theme.centerChannelColor, 0.15), 1); changeCss('.app__body #post-create', 'color:' + theme.centerChannelColor, 2); changeCss('.app__body .mentions--top, .app__body .suggestion-list', 'box-shadow:' + changeOpacity(theme.centerChannelColor, 0.2) + ' 1px -3px 12px', 3); changeCss('.app__body .mentions--top, .app__body .suggestion-list', '-webkit-box-shadow:' + changeOpacity(theme.centerChannelColor, 0.2) + ' 1px -3px 12px', 2); diff --git a/webapp/utils/web_client.jsx b/webapp/utils/web_client.jsx index 04fba0c5b..f6e2d6ac5 100644 --- a/webapp/utils/web_client.jsx +++ b/webapp/utils/web_client.jsx @@ -6,6 +6,8 @@ import TeamStore from '../stores/team_store.jsx'; import BrowserStore from '../stores/browser_store.jsx'; import * as GlobalActions from 'action_creators/global_actions.jsx'; +import request from 'superagent'; + const HTTP_UNAUTHORIZED = 401; class WebClientClass extends Client { @@ -82,6 +84,17 @@ class WebClientClass extends Client { } ); } + + getYoutubeVideoInfo(googleKey, videoId, success, error) { + request.get('https://www.googleapis.com/youtube/v3/videos'). + query({part: 'snippet', id: videoId, key: googleKey}). + end((err, res) => { + if (err) { + return error(err); + } + return success(res.body); + }); + } } var WebClient = new WebClientClass(); -- cgit v1.2.3-1-g7c22