mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
fix dupe report submission
This commit is contained in:
parent
c1b92967c6
commit
0d3555c3da
1 changed files with 3 additions and 2 deletions
|
@ -10,6 +10,7 @@ defmodule PhilomenaWeb.DuplicateReportController do
|
||||||
@valid_states ~W(open rejected accepted claimed)
|
@valid_states ~W(open rejected accepted claimed)
|
||||||
|
|
||||||
plug PhilomenaWeb.FilterBannedUsersPlug when action in [:create]
|
plug PhilomenaWeb.FilterBannedUsersPlug when action in [:create]
|
||||||
|
plug PhilomenaWeb.UserAttributionPlug when action in [:create]
|
||||||
plug :load_resource, model: DuplicateReport, only: [:show], preload: [:image, :duplicate_of_image]
|
plug :load_resource, model: DuplicateReport, only: [:show], preload: [:image, :duplicate_of_image]
|
||||||
|
|
||||||
def index(conn, params) do
|
def index(conn, params) do
|
||||||
|
@ -29,11 +30,11 @@ defmodule PhilomenaWeb.DuplicateReportController do
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(conn, %{"duplicate_report" => duplicate_report_params}) do
|
def create(conn, %{"duplicate_report" => duplicate_report_params}) do
|
||||||
attribution = conn.assigns.attribution
|
attributes = conn.assigns.attributes
|
||||||
source = Repo.get!(Image, duplicate_report_params["image_id"])
|
source = Repo.get!(Image, duplicate_report_params["image_id"])
|
||||||
target = Repo.get!(Image, duplicate_report_params["duplicate_of_image_id"])
|
target = Repo.get!(Image, duplicate_report_params["duplicate_of_image_id"])
|
||||||
|
|
||||||
case DuplicateReports.create_duplicate_report(source, target, attribution, duplicate_report_params) do
|
case DuplicateReports.create_duplicate_report(source, target, attributes, duplicate_report_params) do
|
||||||
{:ok, duplicate_report} ->
|
{:ok, duplicate_report} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Duplicate report created successfully.")
|
|> put_flash(:info, "Duplicate report created successfully.")
|
||||||
|
|
Loading…
Reference in a new issue