Users can remove themselves from buckets

This commit is contained in:
Jose Farias
2024-12-13 14:07:48 -06:00
parent 738590bcaf
commit ce0577d3c1
4 changed files with 5 additions and 14 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class BucketsController < ApplicationController
@bucket.update! bucket_params
@bucket.accesses.revise granted: grantees, revoked: revokees
redirect_to edit_bucket_path(@bucket)
redirect_to bubbles_path(bucket_ids: [ @bucket ])
end
def destroy
-9
View File
@@ -5,13 +5,4 @@ module AccessesHelper
locals: { selected: selected },
cached: ->(user) { [ user, selected ] }
end
def access_toggle_tag(user, &)
tag.li class: "flex align-center gap-half margin-none unpad", data: {
value: user.name.downcase,
creator_id: user.id,
controller: "created-by-current-user",
created_by_current_user_target: "creation",
created_by_current_user_mine_class: "toggler--toggled" }, &
end
end
+2 -2
View File
@@ -1,4 +1,4 @@
<%= access_toggle_tag user do %>
<li class="flex align-center gap-half margin-none unpad" data-value="<%= user.name.downcase %>">
<figure class="avatar flex-item-no-shrink">
<%= avatar_tag user, loading: :lazy %>
</figure>
@@ -18,4 +18,4 @@
<span class="switch__btn round"></span>
<span class="for-screen-reader">Give <%= user.name %> access</span>
</label>
<% end %>
</li>
+2 -2
View File
@@ -34,7 +34,7 @@ class BucketsControllerTest < ActionDispatch::IntegrationTest
test "update" do
patch bucket_url(buckets(:writebook)), params: { bucket: { name: "Writebook bugs" }, user_ids: users(:david, :jz).pluck(:id) }
assert_redirected_to edit_bucket_url(buckets(:writebook))
assert_redirected_to bubbles_url(bucket_ids: [ buckets(:writebook) ])
assert_equal "Writebook bugs", buckets(:writebook).reload.name
assert_equal users(:david, :jz), buckets(:writebook).users
assert_not buckets(:writebook).all_access?
@@ -47,7 +47,7 @@ class BucketsControllerTest < ActionDispatch::IntegrationTest
patch bucket_url(bucket), params: { bucket: { name: "Bugs", all_access: true } }
assert_redirected_to edit_bucket_url(bucket)
assert_redirected_to bubbles_url(bucket_ids: [ bucket ])
assert bucket.reload.all_access?
assert_equal accounts("37s").users, bucket.users
end