You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
660 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: follow_recommendation_suppressions
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8) not null
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. #
  11. class FollowRecommendationSuppression < ApplicationRecord
  12. include Redisable
  13. belongs_to :account
  14. after_commit :remove_follow_recommendations, on: :create
  15. private
  16. def remove_follow_recommendations
  17. redis.pipelined do
  18. I18n.available_locales.each do |locale|
  19. redis.zrem("follow_recommendations:#{locale}", account_id)
  20. end
  21. end
  22. end
  23. end