1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

change event redact, POST request to PUT request

This commit is contained in:
jkasun
2019-04-07 00:19:02 +05:30
parent 941d93c2f4
commit c495b12cef

View File

@@ -1,3 +1,23 @@
/**
* @param {string} roomId
* @param {string} eventId
* @param {string=} txnId transaction id. One will be made up if not
* supplied.
* @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.redactEvent = function(
roomId, eventId, txnId, callback,
) {
const path = utils.encodeUri("/rooms/$roomId/redact/$eventId/$tnxId", {
$roomId: roomId,
$eventId: eventId,
$txnId: txnId ? txnId : this.makeTxnId(),
});
return this._http.authedRequest(callback, "PUT", path, undefined, {});
};
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd Copyright 2017 Vector Creations Ltd
@@ -891,18 +911,25 @@ MatrixBaseApis.prototype.sendStateEvent = function(roomId, eventType, content, s
/** /**
* @param {string} roomId * @param {string} roomId
* @param {string} eventId * @param {string} eventId
* @param {string=} txnId transaction id. One will be made up if not
* supplied.
* @param {module:client.callback} callback Optional. * @param {module:client.callback} callback Optional.
* @return {module:client.Promise} Resolves: TODO * @return {module:client.Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
MatrixBaseApis.prototype.redactEvent = function(roomId, eventId, callback) { MatrixBaseApis.prototype.redactEvent = function(
const path = utils.encodeUri("/rooms/$roomId/redact/$eventId", { roomId, eventId, txnId, callback,
) {
const path = utils.encodeUri("/rooms/$roomId/redact/$eventId/$tnxId", {
$roomId: roomId, $roomId: roomId,
$eventId: eventId, $eventId: eventId,
$txnId: txnId ? txnId : this.makeTxnId(),
}); });
return this._http.authedRequest(callback, "POST", path, undefined, {});
return this._http.authedRequest(callback, "PUT", path, undefined, {});
}; };
/** /**
* @param {string} roomId * @param {string} roomId
* @param {Number} limit * @param {Number} limit