Fix issues from bad rebase

This commit is contained in:
Karina Kwiatek 2022-07-05 22:31:15 +02:00 committed by Karina Kwiatek
parent 251dff6cda
commit 561946cab9
3 changed files with 16 additions and 4 deletions

View File

@ -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: "🙂")

View File

@ -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"

View File

@ -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"