diff --git a/app/models/user/reaction_methods.rb b/app/models/user/reaction_methods.rb index 895853eb..18ecac25 100644 --- a/app/models/user/reaction_methods.rb +++ b/app/models/user/reaction_methods.rb @@ -5,8 +5,8 @@ module User::ReactionMethods # @param item [ApplicationRecord] the answer/comment to smile def smile(item) # rubocop:disable Style/RedundantSelf - raise Errors::ReactingSelfBlockedOther if self.blocking?(answer.user) - raise Errors::ReactingOtherBlockedSelf if answer.user.blocking?(self) + raise Errors::ReactingSelfBlockedOther if self.blocking?(item.user) + raise Errors::ReactingOtherBlockedSelf if item.user.blocking?(self) # rubocop:enable Style/RedundantSelf ::Appendable::Reaction.create!(user: self, parent: item, content: "🙂") diff --git a/db/schema.rb b/db/schema.rb index 3fa6ac28..3acbc6ff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -50,6 +50,18 @@ ActiveRecord::Schema.define(version: 2022_06_26_134554) do t.index ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at" end + create_table "appendables", force: :cascade do |t| + t.string "type", null: false + t.bigint "user_id", null: false + t.bigint "parent_id", null: false + t.string "parent_type", null: false + t.text "content" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["parent_id", "parent_type"], name: "index_appendables_on_parent_id_and_parent_type" + t.index ["user_id", "created_at"], name: "index_appendables_on_user_id_and_created_at" + end + create_table "comment_smiles", id: :bigint, default: -> { "gen_timestamp_id('comment_smiles'::text)" }, force: :cascade do |t| t.bigint "user_id" t.bigint "comment_id" diff --git a/spec/controllers/ajax/smile_controller_spec.rb b/spec/controllers/ajax/smile_controller_spec.rb index db0e9775..9d6d0506 100644 --- a/spec/controllers/ajax/smile_controller_spec.rb +++ b/spec/controllers/ajax/smile_controller_spec.rb @@ -100,7 +100,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do end it "does not create a smile" do - expect { subject }.not_to(change { Smile.count }) + expect { subject }.not_to(change { Appendable::Reaction.count }) end include_examples "returns the expected response" @@ -124,7 +124,7 @@ describe Ajax::SmileController, :ajax_controller, type: :controller do end it "does not create a smile" do - expect { subject }.not_to(change { Smile.count }) + expect { subject }.not_to(change { Appendable::Reaction.count }) end include_examples "returns the expected response"