mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
ensure reports are reindexed when merged, fixes #51
This commit is contained in:
parent
21d7fda912
commit
b20217925b
2 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue