Fix showing profiles when logged out
This commit is contained in:
parent
836ead6625
commit
10a06fd634
|
@ -135,7 +135,7 @@ defmodule ClacksWeb.FrontendController do
|
|||
current_user: current_user,
|
||||
actor: user.actor,
|
||||
statuses_with_actor: statuses_with_actor,
|
||||
following_state: following_state(current_user.actor, user.actor)
|
||||
following_state: following_state(current_user, user.actor)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -305,9 +305,15 @@ defmodule ClacksWeb.FrontendController do
|
|||
Repo.one(query)
|
||||
end
|
||||
|
||||
@spec following_state(follower :: User.t(), followee :: Actor.t()) ::
|
||||
:following | :not_following | :pending
|
||||
defp following_state(%User{actor: %Actor{} = actor}, followee) do
|
||||
following_state(actor, followee)
|
||||
end
|
||||
|
||||
@spec following_state(follower :: Actor.t(), followee :: Actor.t()) ::
|
||||
:following | :not_following | :pending
|
||||
defp following_state(follower, followee) do
|
||||
defp following_state(%Actor{} = follower, followee) do
|
||||
case follow_activity(follower, followee) do
|
||||
%Activity{data: %{"state" => "pending"}} ->
|
||||
:pending
|
||||
|
@ -319,4 +325,8 @@ defmodule ClacksWeb.FrontendController do
|
|||
:not_following
|
||||
end
|
||||
end
|
||||
|
||||
defp following_state(_, _) do
|
||||
:not_following
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
|
||||
<div class="actor-actions">
|
||||
<%= unless @current_user.actor.ap_id == @actor.ap_id do %>
|
||||
<%= unless @current_user == nil || @current_user.actor.ap_id == @actor.ap_id do %>
|
||||
|
||||
<%= case @following_state do %>
|
||||
<% :not_following -> %>
|
||||
|
|
Loading…
Reference in New Issue