diff --git a/app/controllers/client_api/teams/teams_controller.rb b/app/controllers/client_api/teams/teams_controller.rb
index 45e295bc0..c38ae0fad 100644
--- a/app/controllers/client_api/teams/teams_controller.rb
+++ b/app/controllers/client_api/teams/teams_controller.rb
@@ -31,7 +31,6 @@ module ClientApi
current_user: current_user,
params: team_params)
team_service.update_team!
-
success_response('/client_api/teams/update_details',
team_service.single_team_details_data)
rescue ClientApi::CustomTeamError => error
diff --git a/app/controllers/client_api/users/user_teams_controller.rb b/app/controllers/client_api/users/user_teams_controller.rb
index 5ad2ad18d..bf66fa4ff 100644
--- a/app/controllers/client_api/users/user_teams_controller.rb
+++ b/app/controllers/client_api/users/user_teams_controller.rb
@@ -29,6 +29,19 @@ module ClientApi
unsuccess_response(error.to_s)
end
+ def remove_user
+ ut_service = ClientApi::UserTeamService.new(
+ user: current_user,
+ team_id: params[:team],
+ user_team_id: params[:user_team]
+ )
+ ut_service.destroy_user_team_and_assign_new_team_owner!
+ success_response('/client_api/teams/team_users',
+ ut_service.team_users_data)
+ rescue ClientApi::CustomUserTeamError => error
+ unsuccess_response(error.to_s)
+ end
+
private
def success_response(template, locals)
diff --git a/app/javascript/packs/app/routes.js b/app/javascript/packs/app/routes.js
index dec11c714..4d8f1dae9 100644
--- a/app/javascript/packs/app/routes.js
+++ b/app/javascript/packs/app/routes.js
@@ -27,6 +27,7 @@ export const CONTACT_US_LINK =
// user teams
export const LEAVE_TEAM_PATH = "/client_api/users/leave_team";
export const UPDATE_USER_TEAM_ROLE_PATH = "/client_api/users/update_role";
+export const REMOVE_USER_FROM_TEAM_PATH = "/client_api/users/remove_user";
// settings
export const SETTINGS_ACCOUNT_PROFILE = "/settings/account/profile";
diff --git a/app/javascript/packs/locales/messages.js b/app/javascript/packs/locales/messages.js
index 9989ee23f..548a26733 100644
--- a/app/javascript/packs/locales/messages.js
+++ b/app/javascript/packs/locales/messages.js
@@ -70,6 +70,15 @@ export default {
warning_message_three: "all repository protocols in the team belonging to you will be reassigned onto a new owner from team administrators.",
leave_team: "Leave"
},
+ remove_user_modal: {
+ title: "Remove user {user} from team {team}",
+ subtitle: "Are you sure you wish to remove user {user} from team {team}?",
+ warnings: "Removing user from team has following consequences:",
+ warning_message_one: "user will lose access to all content belonging to the team (including projects, tasks, protocols and activities);",
+ warning_message_two: "all projects in the team where user was the sole Owner will be reassigned onto you as a new owner;",
+ warning_message_three: "all repository protocols in the team belonging to user will be reassigned onto you.",
+ remove_user: "Remove user"
+ },
update_team_description_modal: {
title: "Edit team description",
label: "Description"
diff --git a/app/javascript/packs/src/settings/components/team/SettingsTeamPageContainer.jsx b/app/javascript/packs/src/settings/components/team/SettingsTeamPageContainer.jsx
index eb19963d4..921af9d21 100644
--- a/app/javascript/packs/src/settings/components/team/SettingsTeamPageContainer.jsx
+++ b/app/javascript/packs/src/settings/components/team/SettingsTeamPageContainer.jsx
@@ -163,7 +163,7 @@ class SettingsTeamPageContainer extends Component {
{
+ this.props.updateUsersCallback(response.data.team_users);
+ this.props.hideModal();
+ })
+ .catch(error => console.log(error));
+ }
+
+ render() {
+ const { teamName, userName } = this.props.userToRemove;
+ return (
+
+
+
+
+
+
+
+