ensure reports are reindexed when merged, fixes #51

This commit is contained in:
byte[] 2020-03-26 13:42:11 -04:00
parent 21d7fda912
commit b20217925b
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,7 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptController do
alias Philomena.DuplicateReports.DuplicateReport
alias Philomena.DuplicateReports
alias Philomena.Reports
alias Philomena.Images
plug PhilomenaWeb.CanaryMapPlug, create: :edit, delete: :edit
@ -14,12 +15,13 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptController do
preload: [:image, :duplicate_of_image]
def create(conn, _params) do
{:ok, _report} =
{:ok, %{reports: {_count, reports}}} =
DuplicateReports.accept_duplicate_report(
conn.assigns.duplicate_report,
conn.assigns.current_user
)
Reports.reindex_reports(reports)
Images.reindex_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.duplicate_of_image)

View file

@ -3,6 +3,7 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptReverseController do
alias Philomena.DuplicateReports.DuplicateReport
alias Philomena.DuplicateReports
alias Philomena.Reports
alias Philomena.Images
plug PhilomenaWeb.CanaryMapPlug, create: :edit, delete: :edit
@ -14,12 +15,13 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptReverseController do
preload: [:image, :duplicate_of_image]
def create(conn, _params) do
{:ok, _report} =
{:ok, %{reports: {_count, reports}}} =
DuplicateReports.accept_reverse_duplicate_report(
conn.assigns.duplicate_report,
conn.assigns.current_user
)
Reports.reindex_reports(reports)
Images.reindex_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.duplicate_of_image)