diff --git a/app/models/concerns/smooch_blocking.rb b/app/models/concerns/smooch_blocking.rb index 234e9d1ba3..ac2722c71c 100644 --- a/app/models/concerns/smooch_blocking.rb +++ b/app/models/concerns/smooch_blocking.rb @@ -22,7 +22,7 @@ def block_user(uid) block.save! Rails.logger.info("[Smooch Bot] Blocked user #{uid}") Rails.cache.write("smooch:banned:#{uid}", Time.now.to_i) - apply_content_warning_to_user_content(uid) + self.delay.apply_content_warning_to_user_content(uid) rescue ActiveRecord::RecordNotUnique # User already blocked Rails.logger.info("[Smooch Bot] User #{uid} already blocked") @@ -57,7 +57,7 @@ def apply_content_warning_to_user_content(uid) 'racy': 0, 'spam': 1 } - Dynamic.delay.create!(annotation_type: 'flag', annotated: pm, annotator: current_user, skip_check_ability: true, set_fields: { show_cover: true, flags: flags }.to_json) + Dynamic.create!(annotation_type: 'flag', annotated: pm, annotator: User.current, skip_check_ability: true, set_fields: { show_cover: true, flags: flags }.to_json) end RequestStore.store[:skip_rules] = false end diff --git a/db/schema.rb b/db/schema.rb index 58daa330f3..0b9c7f5a26 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -293,6 +293,7 @@ t.index ["field_type"], name: "index_dynamic_annotation_fields_on_field_type" t.index ["value"], name: "fetch_unique_id", unique: true, where: "(((field_name)::text = 'external_id'::text) AND (value <> ''::text) AND (value <> '\"\"'::text))" t.index ["value"], name: "index_status", where: "((field_name)::text = 'verification_status_status'::text)" + t.index ["value"], name: "smooch_request_message_id_unique_id", unique: true, where: "(((field_name)::text = 'smooch_message_id'::text) AND (value <> ''::text) AND (value <> '\"\"'::text))" t.index ["value"], name: "smooch_user_unique_id", unique: true, where: "(((field_name)::text = 'smooch_user_id'::text) AND (value <> ''::text) AND (value <> '\"\"'::text))" t.index ["value"], name: "translation_request_id", unique: true, where: "((field_name)::text = 'translation_request_id'::text)" t.index ["value_json"], name: "index_dynamic_annotation_fields_on_value_json", using: :gin @@ -468,7 +469,7 @@ t.index ["user_id"], name: "index_project_media_users_on_user_id" end - create_table "project_medias", force: :cascade do |t| + create_table "project_medias", id: :serial, force: :cascade do |t| t.integer "project_id" t.integer "media_id" t.integer "user_id" @@ -860,7 +861,8 @@ end create_table "versions", id: :serial, force: :cascade do |t| - t.string "item_type", null: false + t.string "item_type" + t.string "{:null=>false}" t.string "item_id", null: false t.string "event", null: false t.string "whodunnit"