@@ -33,6 +33,8 @@ import * as ReportUtils from '../../libs/ReportUtils';
33
33
import FormHelpMessage from '../../components/FormHelpMessage' ;
34
34
import TextInput from '../../components/TextInput' ;
35
35
import KeyboardDismissingFlatList from '../../components/KeyboardDismissingFlatList' ;
36
+ import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails' ;
37
+ import * as PolicyUtils from '../../libs/PolicyUtils' ;
36
38
37
39
const propTypes = {
38
40
/** The personal details of the person who is logged in */
@@ -247,11 +249,11 @@ class WorkspaceMembersPage extends React.Component {
247
249
}
248
250
249
251
/**
250
- * @param {String } value
252
+ * @param {String } [ value = '']
251
253
* @param {String } keyword
252
254
* @returns {Boolean }
253
255
*/
254
- isKeywordMatch ( value , keyword ) {
256
+ isKeywordMatch ( value = '' , keyword ) {
255
257
return value . trim ( ) . toLowerCase ( ) . includes ( keyword ) ;
256
258
}
257
259
@@ -335,6 +337,18 @@ class WorkspaceMembersPage extends React.Component {
335
337
|| this . isKeywordMatch ( member . firstName , searchValue )
336
338
|| this . isKeywordMatch ( member . lastName , searchValue ) ) ;
337
339
340
+ data = _ . reject ( data , ( member ) => {
341
+ // If this policy is owned by Expensify then show all support (expensify.com or team.expensify.com) emails
342
+ if ( PolicyUtils . isExpensifyTeam ( lodashGet ( this . props . policy , 'owner' ) ) ) {
343
+ return ;
344
+ }
345
+
346
+ // We don't want to show guides as policy members unless the user is not a guide. Some customers get confused when they
347
+ // see random people added to their policy, but guides having access to the policies help set them up.
348
+ const isCurrentUserExpensifyTeam = PolicyUtils . isExpensifyTeam ( this . props . currentUserPersonalDetails . login ) ;
349
+ return ! isCurrentUserExpensifyTeam && PolicyUtils . isExpensifyTeam ( member . login ) ;
350
+ } ) ;
351
+
338
352
_ . each ( data , ( member ) => {
339
353
if ( member . login === this . props . session . email || member . login === this . props . policy . owner || member . pendingAction === CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE ) {
340
354
return ;
@@ -426,13 +440,11 @@ class WorkspaceMembersPage extends React.Component {
426
440
/>
427
441
</ View >
428
442
) : (
429
- ! _ . isEmpty ( policyMemberList ) && (
430
- < View style = { [ styles . ph5 ] } >
431
- < Text style = { [ styles . textLabel , styles . colorMuted ] } >
432
- { this . props . translate ( 'common.noResultsFound' ) }
433
- </ Text >
434
- </ View >
435
- )
443
+ < View style = { [ styles . ph5 ] } >
444
+ < Text style = { [ styles . textLabel , styles . colorMuted ] } >
445
+ { this . props . translate ( 'common.noResultsFound' ) }
446
+ </ Text >
447
+ </ View >
436
448
) }
437
449
</ View >
438
450
</ FullPageNotFoundView >
@@ -458,4 +470,5 @@ export default compose(
458
470
key : ONYXKEYS . SESSION ,
459
471
} ,
460
472
} ) ,
473
+ withCurrentUserPersonalDetails ,
461
474
) ( WorkspaceMembersPage ) ;
0 commit comments