Skip to content

Commit

Permalink
Merge pull request #1011 from matrix-org/t3chguy/add-rooms-roomid-rep…
Browse files Browse the repository at this point in the history
…ort-eventid

Add matrix base API to report an event
  • Loading branch information
t3chguy authored Aug 8, 2019
2 parents e95a133 + c21382d commit 05d77a8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/base-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 05d77a8

Please sign in to comment.