You've already forked matrix-js-sdk
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:
@@ -2269,7 +2269,7 @@ MatrixClient.prototype.mxcUrlToHttp =
|
|||||||
* @return {module:client.Promise} Resolves: to nothing
|
* @return {module:client.Promise} Resolves: to nothing
|
||||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
* @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) => {
|
return Promise.all(this.getRooms().map((room) => {
|
||||||
const isJoined = room.getMyMembership() === "join";
|
const isJoined = room.getMyMembership() === "join";
|
||||||
const looksLikeDm = room.getInvitedAndJoinedMemberCount() === 2;
|
const looksLikeDm = room.getInvitedAndJoinedMemberCount() === 2;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function User(userId) {
|
|||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.presence = "offline";
|
this.presence = "offline";
|
||||||
this.presenceStatusMsg = null;
|
this.presenceStatusMsg = null;
|
||||||
this.statusMessage = "";
|
this._unstable_statusMessage = "";
|
||||||
this.displayName = userId;
|
this.displayName = userId;
|
||||||
this.rawDisplayName = userId;
|
this.rawDisplayName = userId;
|
||||||
this.avatarUrl = null;
|
this.avatarUrl = null;
|
||||||
@@ -187,9 +187,9 @@ User.prototype.getLastActiveTs = function() {
|
|||||||
* Manually set the user's status message.
|
* Manually set the user's status message.
|
||||||
* @param {MatrixEvent} event The <code>im.vector.user_status</code> event.
|
* @param {MatrixEvent} event The <code>im.vector.user_status</code> event.
|
||||||
*/
|
*/
|
||||||
User.prototype.updateStatusMessage = function(event) {
|
User.prototype._unstable_updateStatusMessage = function(event) {
|
||||||
if (!event.getContent()) this.statusMessage = "";
|
if (!event.getContent()) this._unstable_statusMessage = "";
|
||||||
else this.statusMessage = event.getContent()["status"];
|
else this._unstable_statusMessage = event.getContent()["status"];
|
||||||
this._updateModifiedTime();
|
this._updateModifiedTime();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1175,10 +1175,10 @@ SyncApi.prototype._processSyncResponse = async function(
|
|||||||
if (e.isState() && e.getType() === "im.vector.user_status") {
|
if (e.isState() && e.getType() === "im.vector.user_status") {
|
||||||
let user = client.store.getUser(e.getStateKey());
|
let user = client.store.getUser(e.getStateKey());
|
||||||
if (user) {
|
if (user) {
|
||||||
user.updateStatusMessage(e);
|
user._unstable_updateStatusMessage(e);
|
||||||
} else {
|
} else {
|
||||||
user = createNewUser(client, e.getStateKey());
|
user = createNewUser(client, e.getStateKey());
|
||||||
user.updateStatusMessage(e);
|
user._unstable_updateStatusMessage(e);
|
||||||
client.store.storeUser(user);
|
client.store.storeUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user