mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
25 lines
424 B
Ruby
25 lines
424 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PointsLimitExceeded
|
|
def initialize(user)
|
|
@user = user
|
|
end
|
|
|
|
def call
|
|
return false if DawarichSettings.self_hosted?
|
|
|
|
Rails.cache.fetch(cache_key, expires_in: 1.day) do
|
|
@user.points_count >= points_limit
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def cache_key
|
|
"points_limit_exceeded/#{@user.id}"
|
|
end
|
|
|
|
def points_limit
|
|
DawarichSettings::BASIC_PAID_PLAN_LIMIT
|
|
end
|
|
end
|