Let BubbleScoped find its own bucket

Then it will be easier to break things that are double nested out of
that nesting.
This commit is contained in:
David Heinemeier Hansson
2025-04-05 15:43:58 +02:00
parent 8708ff04c1
commit f725a69dee
14 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
class AssignmentsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def new
render partial: "bubbles/assignment", locals: { bubble: @bubble }
+1 -1
View File
@@ -1,5 +1,5 @@
class BoostsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
count = if params[:boost_count].to_i == @bubble.boosts_count
@@ -1,5 +1,5 @@
class Bubbles::EngagementsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
@bubble.engage
+1 -1
View File
@@ -1,5 +1,5 @@
class Bubbles::ImagesController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def destroy
@bubble.image.purge_later
+1 -1
View File
@@ -1,5 +1,5 @@
class Bubbles::PinsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def show
end
+1 -1
View File
@@ -1,5 +1,5 @@
class Bubbles::PopsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
@bubble.pop!(user: Current.user, reason: params[:reason])
@@ -1,5 +1,5 @@
class Bubbles::PublishesController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
@bubble.publish
@@ -1,5 +1,5 @@
class Bubbles::RecoversController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
redirect_to @bubble.recover_abandoned_creation
@@ -1,5 +1,5 @@
class Bubbles::StagingsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
if params[:stage_id].present?
@@ -1,5 +1,5 @@
class Bubbles::WatchesController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
set_watching_and_redirect(true)
+1 -1
View File
@@ -1,5 +1,5 @@
class CommentsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
before_action :set_comment, only: [ :show, :edit, :update, :destroy ]
before_action :require_own_comment, only: [ :edit, :update, :destroy ]
+6 -2
View File
@@ -2,11 +2,15 @@ module BubbleScoped
extend ActiveSupport::Concern
included do
before_action :set_bubble
before_action :set_bubble, :set_bucket
end
private
def set_bubble
@bubble = @bucket.bubbles.find(params[:bubble_id])
@bubble = Bubble.find(params[:bubble_id])
end
def set_bucket
@bucket = Current.user.buckets.find(@bubble.bucket_id)
end
end
+1 -1
View File
@@ -1,5 +1,5 @@
class ReadingsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def create
mark_bubble_notifications_read
+1 -1
View File
@@ -1,5 +1,5 @@
class TaggingsController < ApplicationController
include BubbleScoped, BucketScoped
include BubbleScoped
def new
render partial: "bubbles/tagging", locals: { bubble: @bubble, tags: Current.account.tags }