Implement reporting events

BUG: 458856
This commit is contained in:
Tobias Fella
2022-09-08 14:20:59 +02:00
parent 7f26651edf
commit 0fc94310c3
8 changed files with 94 additions and 4 deletions

View File

@@ -39,6 +39,8 @@
#include <jobs/downloadfilejob.h>
#include <qt_connection_util.h>
#include <user.h>
#include <csapi/report_content.h>
#include <events/eventcontent.h>
#include "controller.h"
#include "neochatconfig.h"
@@ -1082,3 +1084,13 @@ void NeoChatRoom::updatePushNotificationState(QString type)
m_currentPushNotificationState = PushNotificationState::Default;
Q_EMIT pushNotificationStateChanged(m_currentPushNotificationState);
}
void NeoChatRoom::reportEvent(const QString &eventId, const QString &reason)
{
auto job = connection()->callApi<ReportContentJob>(id(), eventId, -50, reason);
connect(job, &BaseJob::finished, this, [this, job]() {
if (job->error() == BaseJob::Success) {
Q_EMIT positiveMessage(i18n("Report sent successfully."));
}
});
}