Fix @ZmagoD's remarks

This commit is contained in:
Luka Murn 2017-09-21 08:06:11 +02:00
parent 416ccf905d
commit 5429f6bbbd
4 changed files with 18 additions and 17 deletions

View file

@ -8,8 +8,6 @@ module ClientApi
locals: { teams: current_user.teams_data })
end
def new; end
def create
service = ClientApi::Teams::CreateService.new(
current_user: current_user,

View file

@ -31,6 +31,10 @@ const Wrapper = styled.div`
padding: 16px 15px 50px 15px;
`;
const MyFormGroupDiv = styled.div`
margin-bottom: 15px;
`;
class SettingsNewTeam extends Component {
constructor(props) {
super(props);
@ -208,19 +212,19 @@ class SettingsNewTeam extends Component {
<form onSubmit={this.onSubmit} style={{ maxWidth: "500px" }}>
{this.renderTeamNameFormGroup()}
<small>
<FormattedMessage id="settings_page.new_team.name_sublabel" />
</small>
<br />
<br />
<MyFormGroupDiv>
{this.renderTeamNameFormGroup()}
<small>
<FormattedMessage id="settings_page.new_team.name_sublabel" />
</small>
</MyFormGroupDiv>
{this.renderTeamDescriptionFormGroup()}
<small>
<FormattedMessage id="settings_page.new_team.description_sublabel" />
</small>
<br />
<br />
<MyFormGroupDiv>
{this.renderTeamDescriptionFormGroup()}
<small>
<FormattedMessage id="settings_page.new_team.description_sublabel" />
</small>
</MyFormGroupDiv>
<LinkContainer to={SETTINGS_TEAMS_ROUTE}>
<Button>

View file

@ -5,13 +5,13 @@ module ClientApi
def execute
@team = Team.new(@params)
@team.created_by = @user
@team.created_by = @current_user
if @team.save
# Okay, team is created, now
# add the current user as admin
UserTeam.create(
user: @user,
user: @current_user,
team: @team,
role: 2
)

View file

@ -3,7 +3,6 @@ module ClientApi
def initialize(arg)
@params = arg.fetch(:params) { false }
@user = arg.fetch(:current_user) { raise ClientApi::CustomTeamError }
team_id = arg.fetch(:team_id) { raise ClientApi::CustomTeamError }
@team = Team.find_by_id(team_id)
raise ClientApi::CustomTeamError unless @user.teams.include? @team