Skip to content

Commit

Permalink
Add users index on unconfirmed_email (mastodon#25672)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and skerit committed Jul 7, 2023
1 parent faf3939 commit b2aa018
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
18 changes: 0 additions & 18 deletions app/controllers/auth/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ def new
resource.email = current_user.unconfirmed_email || current_user.email if user_signed_in?
end

def create
# Since we don't allow users to request confirmation emails for other accounts when they
# are already logged in, so we can cut on the expensive queries by simply reusing the
# current user.
if user_signed_in?
self.resource = current_user
resource.send_confirmation_instructions
else
self.resource = current_user || User.send_confirmation_instructions(resource_params)
end

if successfully_sent?(resource)
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
else
respond_with(resource)
end
end

def confirm_captcha
check_captcha! do |message|
flash.now[:alert] = message
Expand Down
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_07_02_131023) do
ActiveRecord::Schema.define(version: 2023_07_02_151753) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -1097,6 +1097,7 @@
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, opclass: :text_pattern_ops, where: "(reset_password_token IS NOT NULL)"
t.index ["role_id"], name: "index_users_on_role_id", where: "(role_id IS NOT NULL)"
t.index ["unconfirmed_email"], name: "index_users_on_unconfirmed_email", where: "(unconfirmed_email IS NOT NULL)"
end

create_table "web_push_subscriptions", force: :cascade do |t|
Expand Down

0 comments on commit b2aa018

Please sign in to comment.