Skip to content

Commit 1d0f682

Browse files
authored
Simple Payments: restrict image sources available in Media Library (#24797)
This temoporarily removes Google Photos and Free Photo Library as options from Simple Payments Media Library selection.
1 parent e45843d commit 1d0f682

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

client/components/dialog/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929

3030
.dialog__backdrop.is-hidden {
31-
background-color: rgba( white, 0 );
31+
background-color: transparent;
3232
}
3333

3434
.dialog.card {

client/components/tinymce/plugins/simple-payments/dialog/product-image-picker.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ProductImagePicker extends Component {
9090
role="button"
9191
tabIndex={ 0 }
9292
>
93-
<ProductImage siteId={ siteId } imageId={ this.props.input.value } showEditIcon={ true } />
93+
<ProductImage siteId={ siteId } imageId={ this.props.input.value } showEditIcon />
9494
<RemoveButton onRemove={ this.removeCurrentImage } />
9595
</div>
9696
);
@@ -114,6 +114,7 @@ class ProductImagePicker extends Component {
114114
enabledFilters={ [ 'images' ] }
115115
visible={ isSelecting }
116116
isBackdropVisible={ false }
117+
disabledDataSources={ [ 'pexels', 'google_photos' ] }
117118
labels={ {
118119
confirm: translate( 'Add' ),
119120
} }

client/my-sites/media-library/filter-bar.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import React, { Component } from 'react';
88
import { localize } from 'i18n-calypso';
9-
import { identity, includes, noop, pull } from 'lodash';
9+
import { identity, includes, noop, pull, union } from 'lodash';
1010
import PropTypes from 'prop-types';
1111

1212
/**
@@ -40,6 +40,7 @@ export class MediaLibraryFilterBar extends Component {
4040
post: PropTypes.bool,
4141
isConnected: PropTypes.bool,
4242
disableLargeImageSources: PropTypes.bool,
43+
disabledDataSources: PropTypes.arrayOf( PropTypes.string ),
4344
};
4445

4546
static defaultProps = {
@@ -53,6 +54,7 @@ export class MediaLibraryFilterBar extends Component {
5354
post: false,
5455
isConnected: true,
5556
disableLargeImageSources: false,
57+
disabledDataSources: [],
5658
};
5759

5860
getSearchPlaceholderText() {
@@ -175,13 +177,17 @@ export class MediaLibraryFilterBar extends Component {
175177
}
176178

177179
render() {
180+
const disabledSources = this.props.disableLargeImageSources
181+
? union( this.props.disabledDataSources, largeImageSources )
182+
: this.props.disabledDataSources;
183+
178184
// Dropdown is disabled when viewing any external data source
179185
return (
180186
<div className="media-library__filter-bar">
181187
<DataSource
182188
source={ this.props.source }
183189
onSourceChange={ this.props.onSourceChange }
184-
disabledSources={ this.props.disableLargeImageSources ? largeImageSources : [] }
190+
disabledSources={ disabledSources }
185191
/>
186192

187193
<SectionNav

client/my-sites/media-library/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class MediaLibrary extends Component {
6363
scrollable: PropTypes.bool,
6464
postId: PropTypes.number,
6565
disableLargeImageSources: PropTypes.bool,
66+
disabledDataSources: PropTypes.arrayOf( PropTypes.string ),
6667
};
6768

6869
static defaultProps = {
@@ -72,6 +73,7 @@ class MediaLibrary extends Component {
7273
scrollable: false,
7374
source: '',
7475
disableLargeImageSources: false,
76+
disabledDataSources: [],
7577
};
7678

7779
componentWillMount() {
@@ -209,6 +211,7 @@ class MediaLibrary extends Component {
209211
isConnected={ isConnected( this.props ) }
210212
post={ !! this.props.postId }
211213
disableLargeImageSources={ this.props.disableLargeImageSources }
214+
disabledDataSources={ this.props.disabledDataSources }
212215
/>
213216
{ content }
214217
</div>

client/post-editor/media-modal/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class EditorMediaModal extends Component {
8282
resetView: PropTypes.func,
8383
postId: PropTypes.number,
8484
disableLargeImageSources: PropTypes.bool,
85+
disabledDataSources: PropTypes.arrayOf( PropTypes.string ),
8586
};
8687

8788
static defaultProps = {
@@ -98,6 +99,7 @@ export class EditorMediaModal extends Component {
9899
imageEditorProps: {},
99100
deleteMedia: () => {},
100101
disableLargeImageSources: false,
102+
disabledDataSources: [],
101103
};
102104

103105
constructor( props ) {
@@ -610,6 +612,7 @@ export class EditorMediaModal extends Component {
610612
mediaLibrarySelectedItems={ this.props.mediaLibrarySelectedItems }
611613
postId={ this.props.postId }
612614
disableLargeImageSources={ this.props.disableLargeImageSources }
615+
disabledDataSources={ this.props.disabledDataSources }
613616
scrollable
614617
/>
615618
);

0 commit comments

Comments
 (0)