From 39a63c17f2e99ab75c6712c634eb7482db43aaad Mon Sep 17 00:00:00 2001 From: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com> Date: Thu, 4 Feb 2021 10:00:21 -0500 Subject: [PATCH] Don't update last_buffered timestamp when creating a suggested tweet (#12537) * Don't update last_buffered timestamp when creating a suggested tweet * Downcase email instead to rely on index --- app/controllers/admin/invitations_controller.rb | 2 +- app/controllers/buffer_updates_controller.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/admin/invitations_controller.rb b/app/controllers/admin/invitations_controller.rb index dd4bffc72..c64fe963d 100644 --- a/app/controllers/admin/invitations_controller.rb +++ b/app/controllers/admin/invitations_controller.rb @@ -12,7 +12,7 @@ module Admin email = params.dig(:user, :email) name = params.dig(:user, :name) - if User.exists?(["lower(email) = ? AND registered = ?", email, true]) + if User.exists?(email: email.downcase, registered: true) flash[:error] = "Invitation was not sent. There is already a registered user with the email: #{email}" redirect_to admin_invitations_path return diff --git a/app/controllers/buffer_updates_controller.rb b/app/controllers/buffer_updates_controller.rb index 9b3898712..72111e524 100644 --- a/app/controllers/buffer_updates_controller.rb +++ b/app/controllers/buffer_updates_controller.rb @@ -7,7 +7,6 @@ class BufferUpdatesController < ApplicationController create_main_tweet create_satellite_tweets create_facebook_post - @article.update(last_buffered: Time.current) redirect_back(fallback_location: "/mod") end