Simplify param

This commit is contained in:
Kevin McConnell
2025-02-26 09:15:13 +00:00
parent a238f504e4
commit 385e299db7
3 changed files with 4 additions and 4 deletions
@@ -2,7 +2,7 @@ class Buckets::SubscriptionsController < ApplicationController
include BucketScoped
def update
if params[:subscribed] == "1"
if params[:subscribed]
@bucket.subscribe(Current.user)
else
@bucket.unsubscribe(Current.user)
@@ -8,8 +8,8 @@
<hr class="separator--horizontal flex-item-grow" style="--border-color: var(--color-subtle-dark); --border-style: dashed" aria-hidden="true">
<label class="switch">
<%= form.checkbox :subscribed, { checked: bucket.subscribed_by?(Current.user), id: dom_id(bucket, :subscribed),
class: "switch__input", data: { action: "form#submit" } } %>
<%= form.checkbox :subscribed, checked: bucket.subscribed_by?(Current.user), id: dom_id(bucket, :subscribed),
class: "switch__input", include_hidden: false, data: { action: "form#submit" } %>
<span class="switch__btn round"></span>
<span class="for-screen-reader">Enable notifications for this bucket</span>
</label>
@@ -17,7 +17,7 @@ class Buckets::SubscriptionsControllerTest < ActionDispatch::IntegrationTest
buckets(:writebook).subscribe(users(:jz))
assert_changes -> { buckets(:writebook).subscribed_by?(users(:jz)) }, from: true, to: false do
put bucket_subscriptions_url(buckets(:writebook)), params: { subscribed: "0" }
put bucket_subscriptions_url(buckets(:writebook))
end
assert_response :success