Push chat snapshots at save time instead of handle time

This commit is contained in:
Keir Nellyer 2016-08-19 16:07:06 +01:00
parent a1a604757b
commit 2a62abfd33

View File

@ -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<Long> saveReport(Report report)
{
return _reportRepository.updateReport(report);
CompletableFuture<Long> 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<Void> setHandlerAborted(Report report, boolean aborted)