-
-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement API for setting RM #419
Changes from 1 commit
c3455a1
202d8e6
caf214b
9ce8047
ce49124
a6b75fe
bf24f7a
562a3c2
edaa646
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -842,6 +842,43 @@ MatrixClient.prototype.setRoomAccountData = function(roomId, eventType, | |
); | ||
}; | ||
|
||
/** | ||
* @param {string} roomId ID of the room that has been read | ||
* @param {string} eventId ID of the event that has been read | ||
* @param {string} rrEvent the event tracked by the read receipt. This is here for | ||
* convenience because the RR and the RM are commonly updated at the same time as each | ||
* other. Optional. | ||
* @param {module:client.callback} callback Optional. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're deprecating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. OK |
||
* @return {module:client.Promise} Resolves: TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you find something better than this please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it to be terrible to do |
||
* @return {module:http-api.MatrixError} Rejects: with an error response. | ||
*/ | ||
MatrixClient.prototype.setRoomReadMarker = function(roomId, eventId, rrEvent, callback) { | ||
if (typeof rrEventId === 'function') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this a thing? some functions have this sort of hackery, but it's just for backwards compat. You shouldn't need it for a new func There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. given that |
||
callback = rrEvent; | ||
rrEvent = undefined; | ||
} | ||
|
||
const path = utils.encodeUri("/rooms/$roomId/read_marker", { | ||
$roomId: roomId, | ||
}); | ||
const content = { | ||
"m.read_marker": eventId, | ||
}; | ||
|
||
// Add the optional RR update, do local echo like `sendReceipt` | ||
if (rrEvent) { | ||
content["m.read"] = rrEvent.getId(); | ||
const room = this.getRoom(roomId); | ||
if (room) { | ||
room._addLocalEchoReceipt(this.credentials.userId, rrEvent, "m.read"); | ||
} | ||
} | ||
|
||
return this._http.authedRequest( | ||
callback, "POST", path, undefined, content, | ||
); | ||
}; | ||
|
||
/** | ||
* Set a user's power level. | ||
* @param {string} roomId | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it DOOOOOOOOOO?