1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Prefix the status message API with _unstable

It's not a formal feature of Matrix yet, so we should try and avoid people relying on it. This makes it appear as a private API and is very clearly labeled as not intended for use.
This commit is contained in:
Travis Ralston
2018-12-12 23:05:03 -07:00
parent fb65c7f4ba
commit 08b3dfa3b5
3 changed files with 7 additions and 7 deletions

View File

@@ -2269,7 +2269,7 @@ MatrixClient.prototype.mxcUrlToHttp =
* @return {module:client.Promise} Resolves: to nothing
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixClient.prototype.setStatusMessage = function(newMessage) {
MatrixClient.prototype._unstable_setStatusMessage = function(newMessage) {
return Promise.all(this.getRooms().map((room) => {
const isJoined = room.getMyMembership() === "join";
const looksLikeDm = room.getInvitedAndJoinedMemberCount() === 2;

View File

@@ -49,7 +49,7 @@ function User(userId) {
this.userId = userId;
this.presence = "offline";
this.presenceStatusMsg = null;
this.statusMessage = "";
this._unstable_statusMessage = "";
this.displayName = userId;
this.rawDisplayName = userId;
this.avatarUrl = null;
@@ -187,9 +187,9 @@ User.prototype.getLastActiveTs = function() {
* Manually set the user's status message.
* @param {MatrixEvent} event The <code>im.vector.user_status</code> event.
*/
User.prototype.updateStatusMessage = function(event) {
if (!event.getContent()) this.statusMessage = "";
else this.statusMessage = event.getContent()["status"];
User.prototype._unstable_updateStatusMessage = function(event) {
if (!event.getContent()) this._unstable_statusMessage = "";
else this._unstable_statusMessage = event.getContent()["status"];
this._updateModifiedTime();
};

View File

@@ -1175,10 +1175,10 @@ SyncApi.prototype._processSyncResponse = async function(
if (e.isState() && e.getType() === "im.vector.user_status") {
let user = client.store.getUser(e.getStateKey());
if (user) {
user.updateStatusMessage(e);
user._unstable_updateStatusMessage(e);
} else {
user = createNewUser(client, e.getStateKey());
user.updateStatusMessage(e);
user._unstable_updateStatusMessage(e);
client.store.storeUser(user);
}
}