From 724b3a97b153fcc0922568e8285e34ac6b4d5dad Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Tue, 31 Mar 2020 11:09:44 -0400 Subject: [PATCH] add edit timestamp, edit reason to post and comment json --- .../views/api/json/comment_view.ex | 12 +++++++++--- .../views/api/json/forum/topic/post_view.ex | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/philomena_web/views/api/json/comment_view.ex b/lib/philomena_web/views/api/json/comment_view.ex index 5d40340b..15900c9d 100644 --- a/lib/philomena_web/views/api/json/comment_view.ex +++ b/lib/philomena_web/views/api/json/comment_view.ex @@ -25,7 +25,9 @@ defmodule PhilomenaWeb.Api.Json.CommentView do author: nil, body: nil, created_at: nil, - updated_at: nil + updated_at: nil, + edited_at: nil, + edit_reason: nil } end @@ -41,7 +43,9 @@ defmodule PhilomenaWeb.Api.Json.CommentView do ), body: nil, created_at: comment.created_at, - updated_at: comment.updated_at + updated_at: comment.updated_at, + edited_at: nil, + edit_reason: nil } end @@ -57,7 +61,9 @@ defmodule PhilomenaWeb.Api.Json.CommentView do ), body: comment.body, created_at: comment.created_at, - updated_at: comment.updated_at + updated_at: comment.updated_at, + edited_at: comment.edited_at, + edit_reason: comment.edit_reason } end end diff --git a/lib/philomena_web/views/api/json/forum/topic/post_view.ex b/lib/philomena_web/views/api/json/forum/topic/post_view.ex index df4eead0..5ed2f7fe 100644 --- a/lib/philomena_web/views/api/json/forum/topic/post_view.ex +++ b/lib/philomena_web/views/api/json/forum/topic/post_view.ex @@ -18,7 +18,11 @@ defmodule PhilomenaWeb.Api.Json.Forum.Topic.PostView do id: post.id, user_id: nil, author: nil, - body: nil + body: nil, + created_at: nil, + updated_at: nil, + edited_at: nil, + edit_reason: nil } end @@ -31,7 +35,11 @@ defmodule PhilomenaWeb.Api.Json.Forum.Topic.PostView do do: UserAttributionView.anonymous_name(post), else: post.user.name ), - body: nil + body: nil, + created_at: post.created_at, + updated_at: post.updated_at, + edited_at: nil, + edit_reason: nil } end @@ -44,7 +52,11 @@ defmodule PhilomenaWeb.Api.Json.Forum.Topic.PostView do do: UserAttributionView.anonymous_name(post), else: post.user.name ), - body: post.body + body: post.body, + created_at: post.created_at, + updated_at: post.updated_at, + edited_at: post.edited_at, + edit_reason: post.edit_reason } end end