mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
chore: Removing duplicate callback to create auth token (#2624)
Removed after create callback in user model to create a new access token. This is already being taken care of by AccessTokenable module. Fixes #2620
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class RemoveDuplicateAccessTokensForExistingUsers < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
# find all models and group them on owner
|
||||
grouped_tokens = AccessToken.all.group_by(&:owner)
|
||||
grouped_tokens.each_value do |duplicates|
|
||||
# we want to keep the latest token as it is being used in all requests
|
||||
duplicates.pop
|
||||
# Remaining ones are duplicates, delete them all
|
||||
duplicates.each { |duplicate| AccessToken.find_by(id: duplicate).destroy }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_07_08_140842) do
|
||||
ActiveRecord::Schema.define(version: 2021_07_14_110714) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
|
||||
Reference in New Issue
Block a user