From 3874d569b4a38c1148dc162327400272d85449c4 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 21 Dec 2019 14:31:32 -0500 Subject: [PATCH] admin comment and post query fixes --- lib/philomena/comments/query.ex | 9 +++++---- lib/philomena/posts/query.ex | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/philomena/comments/query.ex b/lib/philomena/comments/query.ex index 52b52157..4a1de471 100644 --- a/lib/philomena/comments/query.ex +++ b/lib/philomena/comments/query.ex @@ -60,13 +60,14 @@ defmodule Philomena.Comments.Query do "my" => &Philomena.Comments.Query.user_my_transform/2 }) - mod_literal_fields = literal_fields ++ ~W(fingerprint) + mod_literal_fields = ~W(image_id user_id author fingerprint) mod_ip_fields = ~W(ip) mod_bool_fields = ~W(anonymous deleted) mod_aliases = Map.merge(aliases, %{ "deleted" => "hidden_from_users" }) - + mod_custom = user_custom -- ~W(author user_id) + mod_transforms = Map.drop(user_transforms, ["user_id", "author"]) @anonymous_parser Parser.parser( int_fields: int_fields, @@ -97,8 +98,8 @@ defmodule Philomena.Comments.Query do ip_fields: mod_ip_fields, ngram_fields: ngram_fields, bool_fields: mod_bool_fields, - custom_fields: user_custom, - transforms: user_transforms, + custom_fields: mod_custom, + transforms: mod_transforms, aliases: mod_aliases, default_field: default_field ) diff --git a/lib/philomena/posts/query.ex b/lib/philomena/posts/query.ex index b11139ff..305a8ccd 100644 --- a/lib/philomena/posts/query.ex +++ b/lib/philomena/posts/query.ex @@ -57,12 +57,14 @@ defmodule Philomena.Posts.Query do "my" => &Philomena.Posts.Query.user_my_transform/2 }) - mod_literal_fields = literal_fields ++ ~W(fingerprint) + mod_literal_fields = ~W(forum_id topic_id user_id author fingerprint) mod_ip_fields = ~W(ip) mod_bool_fields = ~W(anonymous deleted) mod_aliases = %{ "deleted" => "hidden_from_users" } + mod_custom = user_custom -- ~W(author user_id) + mod_transforms = Map.drop(user_transforms, ["user_id", "author"]) @anonymous_parser Parser.parser( @@ -92,8 +94,8 @@ defmodule Philomena.Posts.Query do ip_fields: mod_ip_fields, ngram_fields: ngram_fields, bool_fields: mod_bool_fields, - custom_fields: user_custom, - transforms: user_transforms, + custom_fields: mod_custom, + transforms: mod_transforms, aliases: mod_aliases, default_field: default_field )