-
-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1011 from matrix-org/t3chguy/add-rooms-roomid-rep…
…ort-eventid Add matrix base API to report an event
- Loading branch information
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
Copyright 2015, 2016 OpenMarket Ltd | ||
Copyright 2017 Vector Creations Ltd | ||
Copyright 2019 The Matrix.org Foundation C.I.C. | ||
Copyright 2019 Michael Telatynski <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
@@ -2053,6 +2054,23 @@ MatrixBaseApis.prototype.agreeToTerms = function( | |
); | ||
}; | ||
|
||
/** | ||
* Reports an event as inappropriate to the server, which may then notify the appropriate people. | ||
* @param {string} roomId The room in which the event being reported is located. | ||
* @param {string} eventId The event to report. | ||
* @param {number} score The score to rate this content as where -100 is most offensive and 0 is inoffensive. | ||
* @param {string} reason The reason the content is being reported. May be blank. | ||
* @returns {module:client.Promise} Resolves to an empty object if successful | ||
*/ | ||
MatrixBaseApis.prototype.reportEvent = function(roomId, eventId, score, reason) { | ||
const path = utils.encodeUri("/rooms/$roomId/report/$eventId", { | ||
$roomId: roomId, | ||
$eventId: eventId, | ||
}); | ||
|
||
return this._http.authedRequest(undefined, "POST", path, null, {score, reason}); | ||
}; | ||
|
||
/** | ||
* MatrixBaseApis object | ||
*/ | ||
|