Skip to content

Commit

Permalink
add user link to post
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowbeetle committed May 8, 2022
1 parent dc49299 commit 63444ee
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule CutTheBullshitWeb.PostLive.PostComponent do
import CutTheBullshitWeb.LiveHelpers

alias Surface.Components.{Link, LivePatch, LiveRedirect}
alias CutTheBullshitWeb.Router.Helpers, as: Routes

require Logger

Expand All @@ -27,7 +28,11 @@ defmodule CutTheBullshitWeb.PostLive.PostComponent do
<span :if={@post.url}>| <Link to={@post.url}>[Website]</Link></span>
</div>
<div class="info-line">
<span>by {@post.user.username}</span>
<span>
by <LiveRedirect to={Routes.user_show_path(CutTheBullshitWeb.Endpoint, :show, @post.user_id)}>
{@post.user.username}
</LiveRedirect>
</span>
<span>{get_humanized_time_difference(NaiveDateTime.utc_now(), @post.inserted_at)}</span>
<span>| <LiveRedirect to={@post_show_path}>{@post.comment_count} comments</LiveRedirect></span>
{#if is_same_user(@current_user, @post.user)}
Expand Down

0 comments on commit 63444ee

Please sign in to comment.