Method: GroupsController#create

Defined in:
app/controllers/groups_controller.rb

#createObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'app/controllers/groups_controller.rb', line 86

def create
  response = Groups::CreateService.new(
    current_user,
    group_params.merge(organization_id: Current.organization.id)
  ).execute
  @group = response[:group]

  if response.success?
    successful_creation_hooks

    notice = if @group.chat_team.present?
               format(
                 _("Group %{group_name} and its Mattermost team were successfully created."),
                 group_name: @group.name
               )
             else
               format(
                 _("Group %{group_name} was successfully created."),
                 group_name: @group.name
               )
             end

    redirect_to @group, notice: notice
  else
    render action: "new"
  end
end