[deploy] Fix unable to unfollow tags (#10324)

This commit is contained in:
Takuma 2020-09-26 03:00:55 +09:00 committed by GitHub
parent cc15266238
commit fb707621d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -74,6 +74,7 @@ class AsyncInfoController < ApplicationController
def user_cache_key
"user-info-#{current_user&.id}__
#{current_user&.last_sign_in_at}__
#{current_user&.following_tags_count}__
#{current_user&.last_followed_at}__
#{current_user&.updated_at}__
#{current_user&.reactions_count}__

View file

@ -19,7 +19,8 @@ class UserDecorator < ApplicationDecorator
].freeze
def cached_followed_tags
follows_map = Rails.cache.fetch("user-#{id}-#{last_followed_at&.rfc3339}/followed_tags", expires_in: 20.hours) do
follows_map = Rails.cache.fetch("user-#{id}-#{following_tags_count}-#{last_followed_at&.rfc3339}/followed_tags",
expires_in: 20.hours) do
Follow.follower_tag(id).pluck(:followable_id, :points).to_h
end