@@ -17,6 +17,7 @@ import theme from '../styles/theme'
1717import { getTeam , getTeamMembers , addMember , removeMember , joinTeam , assignModerator , removeModerator ,
1818 getTeamJoinInvitations , createTeamJoinInvitation } from '../lib/teams-api'
1919import { getTeamProfile , getUserOrgProfile , getUserTeamProfile } from '../lib/profiles-api'
20+ import { getOrgStaff } from '../lib/org-api'
2021import { toast } from 'react-toastify'
2122const { publicRuntimeConfig } = getConfig ( )
2223
@@ -53,7 +54,6 @@ export default class Team extends Component {
5354 const { id } = this . props
5455 try {
5556 const invitations = await getTeamJoinInvitations ( id )
56- console . log ( publicRuntimeConfig )
5757 if ( invitations . length ) {
5858 this . setState ( {
5959 joinLink : join ( publicRuntimeConfig . APP_URL , 'teams' , id , 'invitations' , invitations [ 0 ] . id )
@@ -84,10 +84,18 @@ export default class Team extends Component {
8484 let teamProfile = [ ]
8585 teamMembers = await getTeamMembers ( id )
8686 teamProfile = await getTeamProfile ( id )
87+
88+ let orgOwners = [ ]
89+ if ( team . org ) {
90+ // Get organization owners
91+ const { owners } = await getOrgStaff ( team . org . organization_id )
92+ orgOwners = owners . map ( ( owner ) => parseInt ( owner . id ) )
93+ }
8794 this . setState ( {
8895 team,
8996 teamProfile,
9097 teamMembers,
98+ orgOwners,
9199 loading : false
92100 } )
93101 } catch ( e ) {
@@ -205,7 +213,7 @@ export default class Team extends Component {
205213 }
206214
207215 render ( ) {
208- const { team, error, teamProfile, teamMembers, joinLink } = this . state
216+ const { team, error, teamProfile, teamMembers, orgOwners , joinLink } = this . state
209217
210218 if ( error ) {
211219 if ( error . status === 401 || error . status === 403 ) {
@@ -236,7 +244,7 @@ export default class Team extends Component {
236244 const moderators = map ( prop ( 'osm_id' ) , teamMembers . moderators )
237245
238246 // TODO: moderators is an array of ints while members are an array of strings. fix this.
239- const isUserModerator = contains ( parseInt ( userId ) , moderators )
247+ const isUserModerator = contains ( parseInt ( userId ) , moderators ) || contains ( parseInt ( userId ) , orgOwners )
240248 const isMember = contains ( userId , members )
241249
242250 const columns = [
0 commit comments