Migrate unsubscribe keys to the database.

This should reduce a lot of the keys in redis.
This commit is contained in:
Robin Ward
2015-02-13 14:15:49 -05:00
parent 86c7071559
commit 3ce2077aa8
12 changed files with 133 additions and 46 deletions

View File

@ -10,7 +10,7 @@ class EmailController < ApplicationController
end
def unsubscribe
@user = User.find_by_temporary_key(params[:key])
@user = DigestUnsubscribeKey.user_for_key(params[:key])
# Don't allow the use of a key while logged in as a different user
if current_user.present? && (@user != current_user)
@ -28,7 +28,7 @@ class EmailController < ApplicationController
end
def resubscribe
@user = User.find_by_temporary_key(params[:key])
@user = DigestUnsubscribeKey.user_for_key(params[:key])
raise Discourse::NotFound unless @user.present?
@user.update_column(:email_digests, true)
end