Add deactivates_at date to user blocks

Block deactivation dates that take needs_view-block views into account were derived using updated_at. This was possible because inactive blocks couldn't be edited and their updated_at date wouldn't change. With editing of inactive blocks enabled deactivation date needs to be saved explicitly.
This commit is contained in:
Anton Khorev 2024-08-13 13:57:31 +03:00
parent 41b81bd393
commit cff4c63713
8 changed files with 165 additions and 15 deletions

View file

@ -2,12 +2,14 @@ FactoryBot.define do
factory :user_block do
sequence(:reason) { |n| "User Block #{n}" }
ends_at { Time.now.utc + 1.day }
deactivates_at { ends_at }
user
creator :factory => :moderator_user
trait :needs_view do
needs_view { true }
deactivates_at { nil }
end
trait :expired do