694783e5f3
We use a true/false preference so we can tell the difference between disabling the watch vs never having the watch. This is so we can toggle off and on the preferences for a container (like the bucket) without losing any bubble-specific preferences.
22 lines
460 B
Ruby
22 lines
460 B
Ruby
class Bubbles::WatchesController < ApplicationController
|
|
include BubbleScoped, BucketScoped
|
|
|
|
def show
|
|
@watchers = @bubble.watchers.without(Current.user)
|
|
end
|
|
|
|
def create
|
|
set_watching_and_redirect(true)
|
|
end
|
|
|
|
def destroy
|
|
set_watching_and_redirect(false)
|
|
end
|
|
|
|
private
|
|
def set_watching_and_redirect(watching)
|
|
@bubble.set_watching(Current.user, watching)
|
|
redirect_to bucket_bubble_watch_path(@bucket, @bubble)
|
|
end
|
|
end
|