-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete organisation members and unaccepted invitations (#711)
Co-authored-by: Shivam Singhal <[email protected]> Co-authored-by: Samrat Man Singh <[email protected]>
- Loading branch information
1 parent
1e951ff
commit 244b45e
Showing
18 changed files
with
170 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Accounts::MembershipsController < SignedInApplicationController | ||
before_action :require_write_access!, only: %i[destroy] | ||
|
||
def destroy | ||
@membership = current_organization.memberships.find_by(id: params[:id]) | ||
|
||
if @membership.blank? | ||
redirect_to teams_accounts_organization_path(current_organization), | ||
flash: {error: "Could not find the member to remove."} | ||
return | ||
end | ||
|
||
unless helpers.can_current_user_remove_member?(@membership.user) | ||
redirect_to teams_accounts_organization_path(current_organization), | ||
flash: {error: "You don't have permission to remove this member"} | ||
return | ||
end | ||
|
||
if @membership.discarded? | ||
redirect_to teams_accounts_organization_path(current_organization), | ||
flash: {error: "Member was already removed"} | ||
elsif @membership.discard | ||
redirect_to teams_accounts_organization_path(current_organization), | ||
notice: "Member #{@membership.user.email} has been removed" | ||
else | ||
redirect_to teams_accounts_organization_path(current_organization), | ||
flash: {error: @membership.errors.full_messages.to_sentence} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= render V2::EmptyStateComponent.new(title: "Oops! Looks like you don't belong to any organization", | ||
text: "Please contact your admin to add you to an organization.", | ||
type: :subdued, | ||
banner_image: "v2/building.svg") %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ x-app: &app | |
tmpfs: | ||
- /tmp | ||
- /app/tmp/pids | ||
- /rails/tmp/pids | ||
|
||
x-backend: &backend | ||
<<: *app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddDiscardedAtToMemberships < ActiveRecord::Migration[7.2] | ||
disable_ddl_transaction! | ||
|
||
def change | ||
add_column :memberships, :discarded_at, :datetime | ||
add_index :memberships, :discarded_at, algorithm: :concurrently | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.