You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Client setProfile methods update own user
This commit is contained in:
@@ -3702,10 +3702,16 @@ MatrixClient.prototype.setProfileInfo = function(info, data, callback) {
|
||||
* @return {Promise} Resolves: TODO
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.setDisplayName = function(name, callback) {
|
||||
return this.setProfileInfo(
|
||||
MatrixClient.prototype.setDisplayName = async function(name, callback) {
|
||||
const prom = await this.setProfileInfo(
|
||||
"displayname", { displayname: name }, callback,
|
||||
);
|
||||
const user = this.getUser(this.getUserId());
|
||||
if (user) {
|
||||
user.displayName = name;
|
||||
user.emit("User.displayName");
|
||||
}
|
||||
return prom;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3714,10 +3720,16 @@ MatrixClient.prototype.setDisplayName = function(name, callback) {
|
||||
* @return {Promise} Resolves: TODO
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
*/
|
||||
MatrixClient.prototype.setAvatarUrl = function(url, callback) {
|
||||
return this.setProfileInfo(
|
||||
MatrixClient.prototype.setAvatarUrl = async function(url, callback) {
|
||||
const prom = await this.setProfileInfo(
|
||||
"avatar_url", { avatar_url: url }, callback,
|
||||
);
|
||||
const user = this.getUser(this.getUserId());
|
||||
if (user) {
|
||||
user.avatarUrl = url;
|
||||
user.emit("User.avatarUrl");
|
||||
}
|
||||
return prom;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user