don't return description in search if personal instance
This commit is contained in:
parent
6673a24466
commit
addfb2efdd
|
@ -59,7 +59,7 @@ config :backend, Backend.Repo,
|
|||
config :backend, :crawler,
|
||||
status_age_limit_days: 28,
|
||||
status_count_limit: 100,
|
||||
personal_instance_threshold: 1,
|
||||
personal_instance_threshold: 5,
|
||||
crawl_interval_mins: 1,
|
||||
crawl_workers: 10,
|
||||
blacklist: [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
defmodule BackendWeb.SearchView do
|
||||
use BackendWeb, :view
|
||||
alias BackendWeb.SearchView
|
||||
require Logger
|
||||
import Backend.Util
|
||||
|
||||
def render("index.json", %{instances: instances, next: next}) do
|
||||
%{
|
||||
|
@ -11,9 +11,18 @@ defmodule BackendWeb.SearchView do
|
|||
end
|
||||
|
||||
def render("instance.json", %{instance: instance}) do
|
||||
threshold = get_config(:personal_instance_threshold)
|
||||
|
||||
description =
|
||||
if instance.user_count != nil and instance.user_count < threshold do
|
||||
nil
|
||||
else
|
||||
instance.description
|
||||
end
|
||||
|
||||
%{
|
||||
name: instance.domain,
|
||||
description: instance.description,
|
||||
description: description,
|
||||
userCount: instance.user_count
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue