mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-04 12:14:37 +08:00
refactor
This commit is contained in:
parent
f0a8275559
commit
015026926d
4 changed files with 6 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
|||
import React, { Component } from "react";
|
||||
import PropTypes, { bool, number, string, func } from "prop-types";
|
||||
import { bool, number, string, func, shape } from "prop-types";
|
||||
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
|
||||
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
|
||||
|
||||
|
@ -87,7 +87,7 @@ class RemoveUserModal extends Component {
|
|||
RemoveUserModal.propTypes = {
|
||||
showModal: bool.isRequired,
|
||||
hideModal: func.isRequired,
|
||||
userToRemove: PropTypes.shape({
|
||||
userToRemove: shape({
|
||||
userName: string.isRequired,
|
||||
team_user_id: number.isRequired,
|
||||
teamName: string.isRequired,
|
||||
|
|
|
@ -37,10 +37,7 @@ class UpdateTeamDescriptionModal extends Component {
|
|||
}
|
||||
|
||||
getValidationState() {
|
||||
if (this.state.errorMessage.length > 0) {
|
||||
return "error";
|
||||
}
|
||||
return null;
|
||||
return this.state.errorMessage.length > 0 ? "error" : null;
|
||||
}
|
||||
|
||||
handleDescription(el) {
|
||||
|
|
|
@ -24,7 +24,7 @@ const StyledHelpBlock = styled(HelpBlock)`
|
|||
class UpdateTeamNameModal extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { errorMessage: "", name: props.team.name};
|
||||
this.state = { errorMessage: "", name: props.team.name };
|
||||
this.onCloseModal = this.onCloseModal.bind(this);
|
||||
this.updateName = this.updateName.bind(this);
|
||||
this.handleName = this.handleName.bind(this);
|
||||
|
@ -37,10 +37,7 @@ class UpdateTeamNameModal extends Component {
|
|||
}
|
||||
|
||||
getValidationState() {
|
||||
if (this.state.errorMessage.length > 0) {
|
||||
return "error";
|
||||
}
|
||||
return null;
|
||||
return this.state.errorMessage.length > 0 ? "error" : null;
|
||||
}
|
||||
|
||||
handleName(el) {
|
||||
|
|
|
@ -5,7 +5,7 @@ describe ClientApi::Teams::TeamsController, type: :controller do
|
|||
|
||||
before do
|
||||
@user_one = User.first
|
||||
@user_two = FactoryGirl.create(:user, email: 'sec_user@asdf.com')
|
||||
@user_two = FactoryGirl.create :user, email: 'sec_user@asdf.com'
|
||||
@team_one = FactoryGirl.create :team
|
||||
@team_two = FactoryGirl.create :team, name: 'Team two'
|
||||
FactoryGirl.create :user_team, team: @team_one, user: @user_one, role: 2
|
||||
|
|
Loading…
Add table
Reference in a new issue