philomena/lib/philomena/posts/attribution.ex

13 lines
No EOL
298 B
Elixir

defimpl Philomena.Attribution, for: Philomena.Posts.Post do
def object_identifier(post) do
to_string(post.topic_id || post.id)
end
def best_user_identifier(post) do
to_string(post.user_id || post.fingerprint || post.ip)
end
def anonymous?(post) do
!!post.anonymous
end
end