mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
always reindex
This commit is contained in:
parent
687db1b98d
commit
eef6da6c78
3 changed files with 11 additions and 3 deletions
|
@ -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.")
|
||||
|
|
|
@ -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.")
|
||||
|
|
|
@ -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.")
|
||||
|
|
Loading…
Reference in a new issue