1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 18:30:53 +00:00

optimize code

This commit is contained in:
LeoSirius
2019-07-05 11:05:26 +08:00
parent 5209ec4671
commit 70a5f74788
2 changed files with 9 additions and 10 deletions

View File

@@ -10,10 +10,9 @@ class LeaveGroupDialog extends React.Component {
super(props);
}
dismissGroup = () => {
let that = this;
leaveGroup = () => {
seafileAPI.quitGroup(this.props.groupID, username).then((res)=> {
that.props.onGroupChanged();
this.props.onGroupChanged();
});
}
@@ -22,11 +21,11 @@ class LeaveGroupDialog extends React.Component {
<Modal isOpen={true} toggle={this.props.toggleLeaveGroupDialog}>
<ModalHeader toggle={this.props.toggleLeaveGroupDialog}>{gettext('Leave Group')}</ModalHeader>
<ModalBody>
<span>{gettext('Really want to leave this group?')}</span>
<p>{gettext('Really want to leave this group?')}</p>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.props.toggleLeaveGroupDialog}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.dismissGroup}>{gettext('Leave')}</Button>
<Button color="primary" onClick={this.leaveGroup}>{gettext('Leave')}</Button>
</ModalFooter>
</Modal>
);

View File

@@ -61,7 +61,7 @@ class GroupView extends React.Component {
showManageMembersDialog: false,
groupMembers: [],
isShowDetails: false,
showLeaveGroupDialog: false,
isLeaveGroupDialogOpen: false,
};
}
@@ -311,7 +311,7 @@ class GroupView extends React.Component {
toggleLeaveGroupDialog = () => {
this.setState({
showLeaveGroupDialog: !this.state.showLeaveGroupDialog,
isLeaveGroupDialogOpen: !this.state.isLeaveGroupDialogOpen,
showGroupDropdown: false,
});
}
@@ -416,7 +416,7 @@ class GroupView extends React.Component {
)}
</div>
<div className="path-tool">
{ (isShowSettingIcon) &&
{ isShowSettingIcon &&
<React.Fragment>
<a href="#" className="sf2-icon-cog1 action-icon group-top-action-icon" title="Settings" id="settings"
onClick={this.toggleGroupDropdown}></a>
@@ -452,7 +452,7 @@ class GroupView extends React.Component {
{/* gourp owner only can dissmiss group, admin could not quit, department member could not quit */}
{(!this.state.isOwner && !this.state.isStaff && !isDepartmentGroup) &&
<ul className="sf-popover-list">
<li><a href="#" className="sf-popover-item" onClick={this.toggleLeaveGroupDialog} >{gettext('Leave Group')}</a></li>
<li><a href="#" className="sf-popover-item" onClick={this.toggleLeaveGroupDialog}>{gettext('Leave Group')}</a></li>
</ul>
}
</div>
@@ -576,7 +576,7 @@ class GroupView extends React.Component {
isOwner={this.state.isOwner}
/>
}
{this.state.showLeaveGroupDialog &&
{this.state.isLeaveGroupDialogOpen &&
<LeaveGroupDialog
toggleLeaveGroupDialog={this.toggleLeaveGroupDialog}
groupID={this.props.groupID}