Commit e103e3e3 authored by Ben Hayward's avatar Ben Hayward

Testing and fixes

1 merge request!617WIP: [Sprint/QuietQuail](feat) Rich embed open in media modals #2162
Pipeline #92906362 passed with stages
in 80 minutes and 16 seconds
......@@ -20,6 +20,7 @@ import { FeaturesService } from '../../../services/features.service';
})
export class MindsRichEmbed {
type: string = '';
mediaSource: string = '';
src: any = {};
preview: any = {};
maxheight: number = 320;
......@@ -68,11 +69,16 @@ export class MindsRichEmbed {
}
init() {
this.openModal = this.mediaModalRequested.observers.length > 0;
// Inline Embedding
let inlineEmbed = this.parseInlineEmbed(this.inlineEmbed);
if (
this.featureService.has('media-modal') &&
this.mediaSource === 'youtube'
) {
this.openModal = this.mediaModalRequested.observers.length > 0;
}
if (
inlineEmbed &&
inlineEmbed.id &&
......@@ -89,7 +95,11 @@ export class MindsRichEmbed {
this.inlineEmbed = inlineEmbed;
if (this.openModal) {
if (
this.openModal &&
this.featureService.has('media-modal') &&
this.mediaSource === 'youtube'
) {
if (this.inlineEmbed && this.inlineEmbed.htmlProvisioner) {
this.inlineEmbed.htmlProvisioner().then(html => {
this.inlineEmbed.html = html;
......@@ -102,7 +112,11 @@ export class MindsRichEmbed {
}
action($event) {
if (this.openModal && this.featureService.has('media-modal')) {
if (
this.openModal &&
this.featureService.has('media-modal') &&
this.mediaSource === 'youtube'
) {
$event.preventDefault();
$event.stopPropagation();
this.mediaModalRequested.emit();
......@@ -146,6 +160,7 @@ export class MindsRichEmbed {
if ((matches = youtube.exec(url)) !== null) {
if (matches[1]) {
this.mediaSource = 'youtube';
return {
id: `video-youtube-${matches[1]}`,
className:
......@@ -164,6 +179,7 @@ export class MindsRichEmbed {
if ((matches = vimeo.exec(url)) !== null) {
if (matches[1]) {
this.mediaSource = 'vimeo';
return {
id: `video-vimeo-${matches[1]}`,
className:
......@@ -182,6 +198,7 @@ export class MindsRichEmbed {
if ((matches = soundcloud.exec(url)) !== null) {
if (matches[1]) {
this.mediaSource = 'soundcloud';
return {
id: `audio-soundcloud-${matches[1]}`,
className:
......@@ -206,9 +223,9 @@ export class MindsRichEmbed {
// Spotify
let spotify = /^(?:https?:\/\/)?open\.spotify\.com\/track\/([a-z0-9]+)/i;
if ((matches = spotify.exec(url)) !== null) {
if (matches[1]) {
this.mediaSource = 'spotify';
return {
id: `audio-spotify-${matches[1]}`,
className:
......@@ -233,7 +250,7 @@ export class MindsRichEmbed {
if (!id) {
return null;
}
this.mediaSource = 'giphy';
return {
id: `image-giphy-${matches[1]}`,
className:
......@@ -251,7 +268,9 @@ export class MindsRichEmbed {
}
hasInlineContentLoaded() {
return !this.openModal && this.inlineEmbed && this.inlineEmbed.html;
return this.featureService.has('media-modal')
? !this.openModal && this.inlineEmbed && this.inlineEmbed.html
: this.embeddedInline && this.inlineEmbed && this.inlineEmbed.html;
}
detectChanges() {
......
......@@ -26,6 +26,7 @@ import isMobileOrTablet from '../../../helpers/is-mobile-or-tablet';
import { ActivityService } from '../../../common/services/activity.service';
import { SiteService } from '../../../common/services/site.service';
import { ClientMetaService } from '../../../common/services/client-meta.service';
import { FeaturesService } from '../../../services/features.service';
export type MediaModalParams = {
redirectUrl?: string;
......@@ -127,6 +128,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
private location: Location,
private site: SiteService,
private clientMetaService: ClientMetaService,
private featureService: FeaturesService,
@SkipSelf() injector: Injector
) {
this.clientMetaService
......@@ -167,6 +169,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
break;
default:
if (
this.featureService.has('media-modal') &&
this.entity.perma_url &&
this.entity.title &&
!this.entity.entity_guid
......@@ -542,12 +545,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
// Show overlay and video controls
onMouseEnterStage() {
if (this.contentType === 'rich-embed') {
this.overlayVisible = false;
}
this.overlayVisible = true;
if (this.contentType === 'video') {
// Make sure progress bar seeker is updating when video controls are visible
this.videoComponent.stageHover = true;
......
......@@ -22,9 +22,10 @@ export class FeaturesService {
if (typeof this._features[feature] === 'undefined') {
if (isDevMode() && !this._hasWarned(feature)) {
console.warn(
`[FeaturedService] Feature '${feature}' is not declared. Assuming false.`
);
console
.warn
// `[FeaturedService] Feature '${feature}' is not declared. Assuming false.`
();
this._warnedCache[feature] = Date.now();
}
......
Please register or to comment