From 76dce674ea6943a5694a11b740dc1d68a38e5ac7 Mon Sep 17 00:00:00 2001 From: Luna D Date: Thu, 5 Dec 2019 15:06:18 -0500 Subject: [PATCH] ip/fp info on posts --- .../templates/post/_post.html.slime | 16 ++++++++++------ lib/philomena_web/views/app_view.ex | 16 ++++++++++++++++ lib/philomena_web/views/comment_view.ex | 16 ---------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/philomena_web/templates/post/_post.html.slime b/lib/philomena_web/templates/post/_post.html.slime index 0e881d73..00db8bc6 100644 --- a/lib/philomena_web/templates/post/_post.html.slime +++ b/lib/philomena_web/templates/post/_post.html.slime @@ -2,13 +2,10 @@ article.block.communication id="post_#{@post.id}" .block__content.flex.flex--no-wrap .flex__fixed.spacing-right = render PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @post, conn: @conn - .flex__grow.communication__body span.communication__body__sender-name = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @post, awards: true, conn: @conn br - = render PhilomenaWeb.UserAttributionView, "_anon_user_title.html", object: @post, conn: @conn - .communication__body__text = if @post.hidden_from_users do strong.comment_deleted @@ -16,12 +13,19 @@ article.block.communication id="post_#{@post.id}" => @post.deletion_reason - else ==<> @body - - .block__content.communication__options .flex.flex--wrap.flex--spaced-out = render PhilomenaWeb.PostView, "_post_options.html", conn: @conn, post: @post - + = if can?(@conn, :hide, @post) do + / todo: make post deletion work + a.communication__interaction.togglable-delete-form-link href="#" + i.fa.fa-times + =<> "Delete" + = if can?(@conn, :manage, @post) do + .communication__info + =<> link_to_ip(@post.ip) + .communication__info + =<> link_to_fingerprint(@post.fingerprint) /- if can?(:hide, Post) / .js-staff-action / - if !post.hidden_from_users && !post.destroyed_content diff --git a/lib/philomena_web/views/app_view.ex b/lib/philomena_web/views/app_view.ex index d3dda133..e204bd84 100644 --- a/lib/philomena_web/views/app_view.ex +++ b/lib/philomena_web/views/app_view.ex @@ -103,4 +103,20 @@ defmodule PhilomenaWeb.AppView do ]) |> to_string() end + + def link_to_ip(ip) do + if ip do + ip + else + "N/A" + end + end + + def link_to_fingerprint(fp) do + if fp do + fp |> String.slice(0..6) + else + "N/A" + end + end end diff --git a/lib/philomena_web/views/comment_view.ex b/lib/philomena_web/views/comment_view.ex index 27b565cc..fbe88c11 100644 --- a/lib/philomena_web/views/comment_view.ex +++ b/lib/philomena_web/views/comment_view.ex @@ -1,19 +1,3 @@ defmodule PhilomenaWeb.CommentView do use PhilomenaWeb, :view - - def link_to_ip(ip) do - if ip do - ip - else - "N/A" - end - end - - def link_to_fingerprint(fp) do - if fp do - fp |> String.slice(0..6) - else - "N/A" - end - end end