🚨Fix Rubocop lint errors
This commit is contained in:
@@ -2,11 +2,11 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table(:users) do |t|
|
||||
## Required
|
||||
t.string :provider, :null => false, :default => "email"
|
||||
t.string :uid, :null => false, :default => ""
|
||||
t.string :provider, null: false, default: 'email'
|
||||
t.string :uid, null: false, default: ''
|
||||
|
||||
## Database authenticatable
|
||||
t.string :encrypted_password, :null => false, :default => ""
|
||||
t.string :encrypted_password, null: false, default: ''
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
@@ -16,7 +16,7 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.0]
|
||||
t.datetime :remember_created_at
|
||||
|
||||
## Trackable
|
||||
t.integer :sign_in_count, :default => 0, :null => false
|
||||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.string :current_sign_in_ip
|
||||
@@ -41,13 +41,13 @@ class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.0]
|
||||
|
||||
## Tokens
|
||||
t.json :tokens
|
||||
t.integer :account_id, :null => false
|
||||
t.integer :account_id, null: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :users, :email
|
||||
add_index :users, [:uid, :provider], :unique => true
|
||||
add_index :users, :reset_password_token, :unique => true
|
||||
add_index :users, [:uid, :provider], unique: true
|
||||
add_index :users, :reset_password_token, unique: true
|
||||
# add_index :users, :confirmation_token, :unique => true
|
||||
# add_index :users, :unlock_token, :unique => true
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ChangeContactToBigint < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
change_column :contacts, :id , :bigint
|
||||
change_column :contacts, :id, :bigint
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
# work properly
|
||||
class ChangeCollationForTagNames < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
if ActsAsTaggableOn::Utils.using_mysql?
|
||||
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
|
||||
end
|
||||
execute('ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;') if ActsAsTaggableOn::Utils.using_mysql?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Addallnametousers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
User.all.each do |u|
|
||||
u.name = "Subash"
|
||||
u.name = 'Subash'
|
||||
u.save!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Notnullableusers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
change_column :users, :name, :string, :null => false
|
||||
change_column :users, :account_id, :integer, :null => false
|
||||
change_column :users, :name, :string, null: false
|
||||
change_column :users, :account_id, :integer, null: false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class AddDisplayId < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
Conversation.all.each do |conversation|
|
||||
conversation.display_id = Conversation.where(account_id: conversation.account_id).maximum("display_id").to_i + 1
|
||||
conversation.display_id = Conversation.where(account_id: conversation.account_id).maximum('display_id').to_i + 1
|
||||
conversation.save!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
class CreateTriggerConversationsInsert < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
change_column :conversations, :display_id, :integer, :null => false
|
||||
change_column :conversations, :display_id, :integer, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
def down; end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class AddUniqueDisplayId < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
remove_index(:conversations, :name => 'index_conversations_on_account_id_and_display_id')
|
||||
add_index :conversations, [:account_id, :display_id], :unique => true
|
||||
remove_index(:conversations, name: 'index_conversations_on_account_id_and_display_id')
|
||||
add_index :conversations, [:account_id, :display_id], unique: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ChangeLastSeenAtToDateTime < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
change_column :conversations, :last_seen_at , :datetime
|
||||
change_column :conversations, :last_seen_at, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,12 @@ class CreateExtensionForFile < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :attachments, :extension, :string, default: nil
|
||||
Attachment.find_each do |attachment|
|
||||
if attachment.external_url and attachment.file_type != fallback
|
||||
attachment.extension = Pathname.new(URI(attachment.external_url).path).extname rescue nil
|
||||
if attachment.external_url && (attachment.file_type != fallback)
|
||||
attachment.extension = begin
|
||||
Pathname.new(URI(attachment.external_url).path).extname
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
attachment.save!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,23 +2,23 @@ class AddPicToInboxMigration < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
FacebookPage.find_each do |inbox|
|
||||
begin
|
||||
url = "http://graph.facebook.com/"<< inbox.page_id << "/picture?type=large"
|
||||
url = 'http://graph.facebook.com/' << inbox.page_id << '/picture?type=large'
|
||||
uri = URI.parse(url)
|
||||
tries = 3
|
||||
begin
|
||||
response = uri.open(redirect: false)
|
||||
rescue OpenURI::HTTPRedirect => redirect
|
||||
uri = redirect.uri # assigned from the "Location" response header
|
||||
retry if (tries -= 1) > 0
|
||||
raise
|
||||
end
|
||||
begin
|
||||
response = uri.open(redirect: false)
|
||||
rescue OpenURI::HTTPRedirect => e
|
||||
uri = e.uri # assigned from the "Location" response header
|
||||
retry if (tries -= 1) > 0
|
||||
raise
|
||||
end
|
||||
pic_url = response.base_uri.to_s
|
||||
puts pic_url.inspect
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
pic_url = nil
|
||||
end
|
||||
inbox.remote_avatar_url = pic_url
|
||||
inbox.save!
|
||||
inbox.remote_avatar_url = pic_url
|
||||
inbox.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class RoundRobin < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
InboxMember.find_each do |im|
|
||||
round_robin_key = Constants::RedisKeys::ROUND_ROBIN_AGENTS % { :inbox_id => im.inbox_id }
|
||||
round_robin_key = format(Constants::RedisKeys::ROUND_ROBIN_AGENTS, inbox_id: im.inbox_id)
|
||||
Redis::Alfred.lpush(round_robin_key, im.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class RenameChannelAttributeNameInModels < ActiveRecord::Migration[6.1]
|
||||
rename_column :users, :channel, :pubsub_token
|
||||
rename_column :contacts, :chat_channel, :pubsub_token
|
||||
|
||||
add_index :users, :pubsub_token, unique: true
|
||||
add_index :contacts, :pubsub_token, unique: true
|
||||
add_index :users, :pubsub_token, unique: true
|
||||
add_index :contacts, :pubsub_token, unique: true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user