From 2a62abfd33f540c9bc2a8bd342fdd28a855173b0 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 19 Aug 2016 16:07:06 +0100 Subject: [PATCH] Push chat snapshots at save time instead of handle time --- .../mineplex/core/report/ReportManager.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index d6565e7b5..562e7e044 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -158,12 +158,6 @@ public class ReportManager int handlerId = _clientManager.Get(reportHandler).getAccountId(); report.setHandlerId(handlerId); - if (report.getCategory() == ReportCategory.CHAT_ABUSE) - { - PushSnapshotsCommand pushCommand = new PushSnapshotsCommand(report.getSuspectId(), reportId); - pushCommand.publish(); - } - // Wait until this has been pushed to the database, otherwise the message task // will not function correctly saveReport(report).thenAccept(reportId2 -> @@ -322,7 +316,18 @@ public class ReportManager */ public CompletableFuture saveReport(Report report) { - return _reportRepository.updateReport(report); + CompletableFuture future = _reportRepository.updateReport(report); + + if (report.getCategory() == ReportCategory.CHAT_ABUSE) + { + future.thenAccept(reportId -> + { + PushSnapshotsCommand pushCommand = new PushSnapshotsCommand(report.getSuspectId(), reportId); + pushCommand.publish(); + }); + } + + return future; } public CompletableFuture setHandlerAborted(Report report, boolean aborted)