...
 
Commits (4)
......@@ -5,6 +5,7 @@ import { Platform } from 'react-native';
import appStores from '../../../AppStores';
import { observable, action } from 'mobx';
import logService from './log.service';
import { FLAG_JOIN_GATHERING } from '../Permissions';
/**
* Gathering service
......@@ -21,7 +22,7 @@ class GatheringService {
*/
@action
async join(entity) {
if (this.isActive) {
if (this.isActive || entity.can(FLAG_JOIN_GATHERING)) {
return;
}
try {
......
......@@ -28,6 +28,7 @@ import colors from '../styles/Colors'
import { ComponentsStyle } from '../styles/Components';
import { CommonStyle } from '../styles/Common';
import i18n from '../common/services/i18n.service';
import { FLAG_SUBSCRIBE } from '../common/Permissions';
@inject('user')
@observer
......@@ -62,7 +63,7 @@ export default class DiscoveryUser extends Component {
renderRightButton() {
const item = this.props.entity.item;
if (this.props.user.me.guid === item.guid || this.props.hideButtons) {
if (this.props.user.me.guid === item.guid || this.props.hideButtons || !item.can(FLAG_SUBSCRIBE)) {
return;
}
if (item.subscribed) {
......
......@@ -38,6 +38,7 @@ import commentsStoreProvider from '../comments/CommentsStoreProvider';
import i18n from '../common/services/i18n.service';
import featuresService from '../common/services/features.service';
import FeedList from '../common/components/FeedList';
import { FLAG_CREATE_POST, FLAG_APPOINT_MODERATOR } from '../common/Permissions';
/**
* Groups view screen
......@@ -225,18 +226,23 @@ export default class GroupViewScreen extends Component {
*/
memberMenuPress = (member) => {
const group = this.props.groupView.group;
const memberActions = [ i18n.t('cancel') ];
const imOwner = this.props.groupView.group['is:owner'];
const imModerator = this.props.groupView.group['is:moderator'];
const imOwner = group['is:owner'];
const imModerator = group['is:moderator'];
if (imOwner) {
if (member['is:owner']) {
memberActions.push( i18n.t('groups.removeOwner') );
} else if (!member['is:moderator']) {
memberActions.push( i18n.t('groups.makeOwner') );
memberActions.push( i18n.t('groups.makeModerator') );
if (group.can(FLAG_APPOINT_MODERATOR)) {
memberActions.push( i18n.t('groups.makeModerator') );
}
} else {
memberActions.push( i18n.t('groups.removeModerator') );
if (group.can(FLAG_APPOINT_MODERATOR)) {
memberActions.push( i18n.t('groups.removeModerator') );
}
}
}
......@@ -315,10 +321,13 @@ export default class GroupViewScreen extends Component {
render() {
const group = this.props.groupView.group;
if (!group) {
return <CenteredLoading/>
}
const showPosterFab = this.props.groupView.tab === 'feed' && group.can(FLAG_CREATE_POST);
const memberActionSheet = this.state.memberActions ?
<ActionSheet
ref={o => this.ActionSheet = o}
......@@ -331,7 +340,7 @@ export default class GroupViewScreen extends Component {
return (
<View style={CS.flexContainer}>
{this.props.groupView.tab === 'feed' && <CaptureFab navigation={this.props.navigation} group={group} /> }
{showPosterFab && <CaptureFab navigation={this.props.navigation} group={group} /> }
{this.getList()}
{memberActionSheet}
</View>
......
......@@ -31,6 +31,7 @@ import gathering from '../../common/services/gathering.service';
import colors from '../../styles/Colors';
import i18n from '../../common/services/i18n.service';
import featuresService from '../../common/services/features.service';
import { FLAG_JOIN, FLAG_JOIN_GATHERING } from '../../common/Permissions';
/**
* Group Header
......@@ -82,7 +83,7 @@ export default class GroupHeader extends Component {
accessibilityLabel={i18n.t('group.subscribeMessage')}
disabled={store.saving}
>
<Text style={CommonStyle.colorPrimary} ref="btntext"> {i18n.t('join').toUpperCase()} </Text>
<Text style={CommonStyle.colorPrimary} ref="btntext"> {i18n.t('join')} </Text>
</TouchableHighlight>
);
} else {
......@@ -94,7 +95,7 @@ export default class GroupHeader extends Component {
accessibilityLabel={i18n.t('group.leaveMessage')}
disabled={store.saving}
>
<Text style={CommonStyle.colorPrimary} ref="btntext"> {i18n.t('leave').toUpperCase()} </Text>
<Text style={CommonStyle.colorPrimary} ref="btntext"> {i18n.t('leave')} </Text>
</TouchableHighlight>
);
}
......@@ -274,8 +275,8 @@ export default class GroupHeader extends Component {
<Text style={styles.name}>{group.name.toUpperCase()}</Text>
</View>
<View style={styles.buttonscol}>
{this.getGatheringButton()}
{this.getActionButton()}
{group.can(FLAG_JOIN_GATHERING) && this.getGatheringButton()}
{group.can(FLAG_JOIN) && this.getActionButton()}
</View>
</View>
</View>
......