hotfix comment creation with locked comments

This commit is contained in:
Luna D 2020-02-22 05:45:17 -05:00
parent fcd57a575a
commit 29dd045202
No known key found for this signature in database
GPG key ID: D0F46C94720BAA4B

View file

@ -43,7 +43,7 @@ defmodule Philomena.Comments do
{:error, %Ecto.Changeset{}} {:error, %Ecto.Changeset{}}
""" """
def create_comment(image, attribution, params \\ %{}) do def create_comment(%Image{commenting_allowed: true} = image, attribution, params \\ %{}) do
comment = comment =
Ecto.build_assoc(image, :comments) Ecto.build_assoc(image, :comments)
|> Comment.creation_changeset(params, attribution) |> Comment.creation_changeset(params, attribution)