field(:fields, {:array, :map}, default: nil)
field(:raw_fields, {:array, :map}, default: [])
field(:discoverable, :boolean, default: false)
+ field(:invisible, :boolean, default: false)
field(:skip_thread_containment, :boolean, default: false)
field(:notification_settings, :map,
def superuser?(%User{local: true, is_moderator: true}), do: true
def superuser?(_), do: false
- def invisible?(%User{info: %User.Info{invisible: true}}), do: true
+ def invisible?(%User{invisible: true}), do: true
def invisible?(_), do: false
def avatar_url(user, options \\ []) do
:fields,
:raw_fields,
:discoverable,
+ :invisible,
:skip_thread_containment,
:notification_settings
]
:follower_count,
:fields,
:following_count,
- :discoverable
+ :discoverable,
+ :invisible
]
)
|> validate_required([:name, :ap_id])
|> cast(params, [:muted_reblogs])
|> update_and_set_cache()
end
+
+ def set_invisible(user, invisible) do
+ params = %{invisible: invisible}
+
+ user
+ |> cast(params, [:invisible])
+ |> validate_required([:invisible])
+ |> update_and_set_cache()
+ end
end
:fields,
:raw_fields,
:discoverable,
+ :invisible,
:skip_thread_containment,
:notification_settings
]
:hide_follows,
:hide_favorites,
:discoverable,
+ :invisible,
:skip_thread_containment
]
add(:fields, {:array, :map}, default: nil)
add(:raw_fields, {:array, :map}, default: [])
add(:discoverable, :boolean, default: false, null: false)
+ add(:invisible, :boolean, default: false, null: false)
add(:notification_settings, :map, default: %{})
add(:skip_thread_containment, :boolean, default: false, null: false)
end
describe "invisible?/1" do
test "returns true for an invisible user" do
- user = insert(:user, local: true, info: %{invisible: true})
+ user = insert(:user, local: true, invisible: true)
assert User.invisible?(user)
end