Skip to content

Commit eeea11b

Browse files
committed
Merge remote-tracking branch 'origin/MC-42105' into MC-24548
2 parents 213722d + d67cf94 commit eeea11b

File tree

4 files changed

+69
-15
lines changed

4 files changed

+69
-15
lines changed

app/code/Magento/ProductVideo/Test/Mftf/Data/ProductVideoData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@
1818
<data key="videoTitle">The New Vimeo Player (You Know, For Videos)</data>
1919
<data key="videoShortTitle">The New Vimeo Player</data>
2020
</entity>
21+
<entity name="VimeoPrivateVideo" type="product_video">
22+
<data key="videoUrl">https://vimeo.com/313826626</data>
23+
</entity>
2124
</entities>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminValidatePrivacyOnVimeoGetVideoInformationTest">
12+
<annotations>
13+
<features value="ProductVideo"/>
14+
<stories value="Add/remove images and videos for all product types and category"/>
15+
<title value="Admin validates Vimeo video privacy when getting video information"/>
16+
<description value="Admin should be able to see warning message when adding Vimeo video with restricted privacy privacy when getting video information"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-42471"/>
19+
<useCaseId value="MC-42105"/>
20+
<group value="productVideo"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
27+
</after>
28+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/>
29+
<actionGroup ref="AdminOpenProductVideoModalActionGroup" stepKey="openAddProductVideoModal"/>
30+
<actionGroup ref="AdminFillProductVideoFieldActionGroup" stepKey="fillVideoUrlField">
31+
<argument name="input" value="{{AdminProductNewVideoSection.videoUrlTextField}}"/>
32+
<argument name="value" value="{{VimeoPrivateVideo.videoUrl}}"/>
33+
</actionGroup>
34+
<actionGroup ref="AdminGetVideoInformationActionGroup" stepKey="clickOnGetVideoInformation"/>
35+
<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForWarningMessage"/>
36+
<see selector="{{AdminConfirmationModalSection.message}}" userInput='Because of its privacy settings, this video cannot be played here.' stepKey="seeAdminWarningMessage"/>
37+
</test>
38+
</tests>

app/code/Magento/ProductVideo/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ Delete,Delete
4141
"Show related video","Show related video"
4242
"Auto restart video","Auto restart video"
4343
"Delete image in all store views","Delete image in all store views"
44+
"Because of its privacy settings, this video cannot be played here.","Because of its privacy settings, this video cannot be played here."

app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -495,28 +495,40 @@ define([
495495
*/
496496
function _onVimeoLoaded(data) {
497497
var tmp,
498-
respData;
498+
respData,
499+
videoDescription = '';
499500

500501
if (!data) {
501502
this._onRequestError($.mage.__('Video not found'));
502503

503504
return null;
504505
}
505506
tmp = data;
506-
respData = {
507-
duration: this._formatVimeoDuration(tmp.duration),
508-
channel: tmp['author_name'],
509-
channelId: tmp['author_url'],
510-
uploaded: tmp['upload_date'],
511-
title: tmp.title,
512-
description: tmp.description.replace(/(&nbsp;|<([^>]+)>)/ig, ''),
513-
thumbnail: tmp['thumbnail_url'],
514-
videoId: videoInfo.id,
515-
videoProvider: videoInfo.type
516-
};
517-
this._videoInformation = respData;
518-
this.element.trigger(this._UPDATE_VIDEO_INFORMATION_TRIGGER, respData);
519-
this.element.trigger(this._FINISH_UPDATE_INFORMATION_TRIGGER, true);
507+
508+
if (tmp.description !== null) {
509+
videoDescription = tmp.description;
510+
}
511+
512+
if (tmp.duration == null) {
513+
this._onRequestError(
514+
$.mage.__('Because of its privacy settings, this video cannot be played here.')
515+
);
516+
} else {
517+
respData = {
518+
duration: this._formatVimeoDuration(tmp.duration),
519+
channel: tmp['author_name'],
520+
channelId: tmp['author_url'],
521+
uploaded: tmp['upload_date'],
522+
title: tmp.title,
523+
description: videoDescription.replace(/(&nbsp;|<([^>]+)>)/ig, ''),
524+
thumbnail: tmp['thumbnail_url'],
525+
videoId: videoInfo.id,
526+
videoProvider: videoInfo.type
527+
};
528+
this._videoInformation = respData;
529+
this.element.trigger(this._UPDATE_VIDEO_INFORMATION_TRIGGER, respData);
530+
this.element.trigger(this._FINISH_UPDATE_INFORMATION_TRIGGER, true);
531+
}
520532
}
521533

522534
type = videoInfo.type;

0 commit comments

Comments
 (0)