Resolve "Allow creation of new direct chat using matrix id"
This commit is contained in:
parent
21d0370d77
commit
590a6caab2
16 changed files with 251 additions and 180 deletions
|
|
@ -378,7 +378,6 @@ export default {
|
|||
},
|
||||
|
||||
onRoom(ignoredroom) {
|
||||
console.log("Got room", ignoredroom);
|
||||
this.reloadRooms();
|
||||
this.updateNotificationCount();
|
||||
},
|
||||
|
|
@ -453,7 +452,6 @@ export default {
|
|||
);
|
||||
}
|
||||
});
|
||||
console.log("Reload rooms", updatedRooms);
|
||||
Vue.set(this, "rooms", updatedRooms);
|
||||
const currentRoom = this.getRoom(this.$store.state.currentRoomId);
|
||||
if (this.currentRoom != currentRoom) {
|
||||
|
|
@ -819,17 +817,12 @@ export default {
|
|||
return this.matrixClient.uploadContent(file, opts);
|
||||
},
|
||||
|
||||
getPublicRoomInfo(roomId) {
|
||||
if (!roomId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = roomId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown room server");
|
||||
}
|
||||
const server = parts[1];
|
||||
|
||||
/**
|
||||
* Get a matrix client that can be used for public queries. If we are logged in, this is the normal
|
||||
* matrix client. If not, we create a temp one with a temp password.
|
||||
* @returns A MatrixClient that can be used for public queries
|
||||
*/
|
||||
getPublicQueryMatrixClient() {
|
||||
var clientPromise;
|
||||
if (this.matrixClient) {
|
||||
clientPromise = this.getMatrixClient().then(() => {
|
||||
|
|
@ -896,6 +889,55 @@ export default {
|
|||
return matrixClient;
|
||||
});
|
||||
}
|
||||
return clientPromise;
|
||||
},
|
||||
|
||||
getPublicUserInfo(userId) {
|
||||
if (!userId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = userId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown home server");
|
||||
}
|
||||
|
||||
const clientPromise = this.getPublicQueryMatrixClient();
|
||||
let matrixClient;
|
||||
return clientPromise
|
||||
.then((client) => {
|
||||
matrixClient = client;
|
||||
return client.getProfileInfo(userId);
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.avatar_url) {
|
||||
response.avatar = matrixClient.mxcUrlToHttp(
|
||||
response.avatar_url,
|
||||
80,
|
||||
80,
|
||||
"scale",
|
||||
true
|
||||
);
|
||||
}
|
||||
return Promise.resolve(response);
|
||||
})
|
||||
.catch((err) => {
|
||||
return Promise.reject("Failed to find user info: " + err);
|
||||
});
|
||||
},
|
||||
|
||||
getPublicRoomInfo(roomId) {
|
||||
if (!roomId) {
|
||||
return Promise.reject("Invalid parameters");
|
||||
}
|
||||
|
||||
const parts = roomId.split(":");
|
||||
if (parts.length != 2) {
|
||||
return Promise.reject("Unknown room server");
|
||||
}
|
||||
const server = parts[1];
|
||||
|
||||
const clientPromise = this.getPublicQueryMatrixClient();
|
||||
|
||||
const findOrGetMore = function _findOrGetMore(client, response) {
|
||||
for (var room of response.chunk) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue