Move users' has_trusted_role keys to redis (#4697) [deploy]

This commit is contained in:
tariq-abughofa 2019-11-04 08:12:19 -05:00 committed by Molly Struve
parent 0591362756
commit 267ec36460
3 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ module AssignTagModerator
user.add_role :trusted
user.update(email_community_mod_newsletter: true)
MailchimpBot.new(user).manage_community_moderator_list
Rails.cache.delete("user-#{user.id}/has_trusted_role")
RedisRailsCache.delete("user-#{user.id}/has_trusted_role")
NotifyMailer.trusted_role_email(user).deliver
end

View file

@ -331,7 +331,7 @@ class User < ApplicationRecord
end
def trusted
Rails.cache.fetch("user-#{id}/has_trusted_role", expires_in: 200.hours) do
RedisRailsCache.fetch("user-#{id}/has_trusted_role", expires_in: 200.hours) do
has_role? :trusted
end
end

View file

@ -148,7 +148,7 @@ module Moderator
end
def update_trusted_cache
Rails.cache.delete("user-#{@user.id}/has_trusted_role")
RedisRailsCache.delete("user-#{@user.id}/has_trusted_role")
@user.trusted
end