Suspended actors don't need refreshing

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-04-20 16:55:55 +02:00
parent cb4a801519
commit 6ad4e33fab
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -1282,11 +1282,13 @@ defmodule Mobilizon.Actors do
@doc """
Whether the actor needs to be updated.
Local actors obviously don't need to be updated
Local actors obviously don't need to be updated, neither do suspended ones
"""
@spec needs_update?(Actor.t()) :: boolean
def needs_update?(%Actor{domain: nil}), do: false
def needs_update?(%Actor{suspended: true}), do: false
def needs_update?(%Actor{last_refreshed_at: nil, domain: domain}) when not is_nil(domain),
do: true