From 9600e2d476efeabddb110a4b0fa3cc4b39d04bd3 Mon Sep 17 00:00:00 2001 From: "Nadler, Sebastian" Date: Mon, 17 Jun 2024 07:05:34 +0000 Subject: [PATCH] Fix rubocop issues --- app/services/meeting_starter.rb | 3 ++- app/services/room_settings_getter.rb | 6 +++--- config/application.rb | 2 +- ...30328124724_populate_voice_brige_for_existing_rooms.rb | 2 ++ db/migrate/20230321125010_add_voice_brige_to_romms.rb | 4 +++- db/schema.rb | 8 ++++---- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/services/meeting_starter.rb b/app/services/meeting_starter.rb index caf3e4e3bf..90a5fa0044 100644 --- a/app/services/meeting_starter.rb +++ b/app/services/meeting_starter.rb @@ -30,7 +30,8 @@ def initialize(room:, base_url:, current_user:, provider:) def call # TODO: amir - Check the legitimately of the action. - options = RoomSettingsGetter.new(room_id: @room.id, provider: @room.user.provider, current_user: @current_user, only_bbb_options: true, voice_bridge: @room.voice_bridge).call + options = RoomSettingsGetter.new(room_id: @room.id, provider: @room.user.provider, current_user: @current_user, only_bbb_options: true, + voice_bridge: @room.voice_bridge).call viewer_code = RoomSettingsGetter.new( room_id: @room.id, provider: @room.user.provider, diff --git a/app/services/room_settings_getter.rb b/app/services/room_settings_getter.rb index 52b85666d0..e57d28efaf 100644 --- a/app/services/room_settings_getter.rb +++ b/app/services/room_settings_getter.rb @@ -103,8 +103,8 @@ def infer_can_record(room_settings:) end def set_voice_brige(room_settings:) - if @voice_bridge != nil - room_settings['voiceBridge'] = "#{@voice_bridge}" - end + return if @voice_bridge.nil? + + room_settings['voiceBridge'] = @voice_bridge.to_s end end diff --git a/config/application.rb b/config/application.rb index b530d89add..8645015a6d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -88,7 +88,7 @@ class Application < Rails::Application config.voice_bridge_phone_number = ENV.fetch('VOICE_BRIDGE_PHONE_NUMBER', nil) config.sip_pin_length = ENV.fetch('SIP_PIN_LENGTH', 5) - + config.i18n.fallbacks = %i[en] config.i18n.enforce_available_locales = false end diff --git a/db/data/20230328124724_populate_voice_brige_for_existing_rooms.rb b/db/data/20230328124724_populate_voice_brige_for_existing_rooms.rb index 2cb7351a9f..9982b88f6e 100644 --- a/db/data/20230328124724_populate_voice_brige_for_existing_rooms.rb +++ b/db/data/20230328124724_populate_voice_brige_for_existing_rooms.rb @@ -22,6 +22,8 @@ def up end def down + # rubocop:disable Rails/SkipsModelValidations Room.update_all(voice_bridge: nil) + # rubocop:enable Rails/SkipsModelValidations end end diff --git a/db/migrate/20230321125010_add_voice_brige_to_romms.rb b/db/migrate/20230321125010_add_voice_brige_to_romms.rb index 42fac35f2a..2b87a390d9 100644 --- a/db/migrate/20230321125010_add_voice_brige_to_romms.rb +++ b/db/migrate/20230321125010_add_voice_brige_to_romms.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + class AddVoiceBrigeToRomms < ActiveRecord::Migration[7.0] def change add_column :rooms, :voice_bridge, :integer, null: true, default: nil - add_index :rooms, :voice_bridge + add_index :rooms, :voice_bridge, unique: true end end diff --git a/db/schema.rb b/db/schema.rb index ba56dfc17c..654f0972ed 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -136,7 +136,7 @@ t.index ["friendly_id"], name: "index_rooms_on_friendly_id", unique: true t.index ["meeting_id"], name: "index_rooms_on_meeting_id", unique: true t.index ["user_id"], name: "index_rooms_on_user_id" - t.index ["voice_bridge"], name: "index_rooms_on_voice_bridge" + t.index ["voice_bridge"], name: "index_rooms_on_voice_bridge", unique: true end create_table "rooms_configurations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -195,12 +195,12 @@ t.uuid "role_id" t.string "language", null: false t.string "reset_digest" - t.datetime "reset_sent_at", precision: nil + t.datetime "reset_sent_at" t.boolean "verified", default: false t.string "verification_digest" - t.datetime "verification_sent_at", precision: nil + t.datetime "verification_sent_at" t.string "session_token" - t.datetime "session_expiry", precision: nil + t.datetime "session_expiry" t.integer "status", default: 0 t.index ["email", "provider"], name: "index_users_on_email_and_provider", unique: true t.index ["reset_digest"], name: "index_users_on_reset_digest", unique: true