Handle user changes
This commit is contained in:
parent
68f87f4048
commit
e63d8f0305
1 changed files with 13 additions and 1 deletions
|
@ -170,6 +170,10 @@ class MattermostClient {
|
|||
}
|
||||
return this.users;
|
||||
}
|
||||
regetUsers() {
|
||||
this.users = null;
|
||||
return this.getUsers();
|
||||
}
|
||||
|
||||
async filePublicLink(file_id) {
|
||||
const response = await this.get(`/files/${file_id}/link`, {});
|
||||
|
@ -187,6 +191,7 @@ class MattermostClient {
|
|||
|
||||
socket.addEventListener("error", event => {
|
||||
console.error("Websocket errored", event.data);
|
||||
this.regetUsers();
|
||||
});
|
||||
|
||||
socket.addEventListener("close", event => {
|
||||
|
@ -208,6 +213,13 @@ class MattermostClient {
|
|||
|
||||
} else if (data.event === "channel_viewed") {
|
||||
pubsub.publish("CHANNEL_READ", {endpoint: this.endpoint, channel_id: data.data.channel_id});
|
||||
|
||||
} else if (
|
||||
data.event === "user_added" ||
|
||||
data.event === "user_updated" ||
|
||||
data.event === "user_removed"
|
||||
) {
|
||||
this.regetUsers();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue