From bafe213d458566b0910bdb0e993fab6e73591df4 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 1 Sep 2020 01:13:33 +1000 Subject: [PATCH] publish: check roles correctly for tags --- .../publish/components/lib/Subscribers.tsx | 25 +++++++++++-------- pkg/interface/src/views/components/Group.tsx | 4 +-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx b/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx index 4ff86c82b..069e851f3 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/Subscribers.tsx @@ -1,11 +1,12 @@ import React, { Component } from 'react'; import { GroupView } from '~/views/components/Group'; -import { resourceFromPath } from '~/logic/lib/group'; +import { resourceFromPath, roleForShip } from '~/logic/lib/group'; import {Notebook} from '~/types/publish-update'; import GlobalApi from '~/logic/api/global'; import {Groups} from '~/types/group-update'; import {Associations} from '~/types/metadata-update'; import {Rolodex} from '~/types/contact-update'; +import {Box, Button} from '@tlon/indigo-react'; interface SubscribersProps { notebook: Notebook; @@ -71,16 +72,20 @@ export class Subscribers extends Component { addDesc: 'Allow user to write to this notebook' }, ]; - + + if(!group) { + return null; + } + + const role = roleForShip(group, window.ship) return ( -
- + + { role === 'admin' && ( + + )} { associations={this.props.associations} api={this.props.api} /> -
+ ); } } diff --git a/pkg/interface/src/views/components/Group.tsx b/pkg/interface/src/views/components/Group.tsx index e364c0aeb..0b8dc9bf3 100644 --- a/pkg/interface/src/views/components/Group.tsx +++ b/pkg/interface/src/views/components/Group.tsx @@ -143,10 +143,8 @@ export class GroupView extends Component< } isAdmin(): boolean { - const us = `~${window.ship}`; const role = roleForShip(this.props.group, window.ship); - const resource = resourceFromPath(this.props.resourcePath); - return resource.ship == us || role === 'admin'; + return role === 'admin'; } optionsForShip(ship: Patp, missing: GroupViewAppTag[]) {