always reindex

This commit is contained in:
byte[] 2019-12-08 23:53:57 -05:00
parent 687db1b98d
commit eef6da6c78
3 changed files with 11 additions and 3 deletions

View file

@ -3,12 +3,15 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptController do
alias Philomena.DuplicateReports.DuplicateReport
alias Philomena.DuplicateReports
alias Philomena.Images
plug PhilomenaWeb.CanaryMapPlug, create: :edit, delete: :edit
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true, preload: [:image, :duplicate_of_image]
def create(conn, _params) do
{:ok, _report} = DuplicateReports.accept_duplicate_report(conn.assigns.duplicate_report, conn.assigns.current_user)
Images.reindex_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.duplicate_of_image)
conn
|> put_flash(:info, "Successfully accepted report.")

View file

@ -3,12 +3,15 @@ defmodule PhilomenaWeb.DuplicateReport.AcceptReverseController do
alias Philomena.DuplicateReports.DuplicateReport
alias Philomena.DuplicateReports
alias Philomena.Images
plug PhilomenaWeb.CanaryMapPlug, create: :edit, delete: :edit
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true, preload: [:image, :duplicate_of_image]
def create(conn, _params) do
{:ok, _report} = DuplicateReports.accept_reverse_duplicate_report(conn.assigns.duplicate_report, conn.assigns.current_user)
Images.reindex_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.duplicate_of_image)
conn
|> put_flash(:info, "Successfully accepted report in reverse.")

View file

@ -6,11 +6,13 @@ defmodule PhilomenaWeb.DuplicateReport.RejectController do
alias Philomena.Images
plug PhilomenaWeb.CanaryMapPlug, create: :edit, delete: :edit
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true, preload: [:image]
plug :load_and_authorize_resource, model: DuplicateReport, id_name: "duplicate_report_id", persisted: true, preload: [:image, :duplicate_of_image]
def create(conn, _params) do
{:ok, _report} = DuplicateReports.reject_duplicate_report(conn.assigns.duplicate_report, conn.assigns.current_user)
{:ok, _image} = Images.unhide_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.image)
Images.reindex_image(conn.assigns.duplicate_report.duplicate_of_image)
conn
|> put_flash(:info, "Successfully rejected report.")