1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-18 05:42:00 +03:00

Guest room ID fixes / initialSync support

This commit is contained in:
Kegan Dougal
2015-12-04 15:31:07 +00:00
parent 71d5756223
commit 02a605f368
2 changed files with 18 additions and 0 deletions

View File

@@ -2080,6 +2080,10 @@ function doInitialSync(client, historyLen, includeArchived, attempt) {
if (includeArchived) { if (includeArchived) {
qps.archived = true; qps.archived = true;
} }
if (client._guestRooms && client._isGuest) {
console.log(client._guestRooms);
qps.room_id = JSON.stringify(client._guestRooms);
}
client._http.authedRequest( client._http.authedRequest(
undefined, "GET", "/initialSync", qps undefined, "GET", "/initialSync", qps
).done(function(data) { ).done(function(data) {
@@ -2251,6 +2255,16 @@ MatrixClient.prototype.startClient = function(opts) {
}; };
function prepareForSync(client, attempt) { function prepareForSync(client, attempt) {
if (client.isGuest()) {
// no push rules for guests
doInitialSync(
client,
client._config.initialSyncLimit,
client._config.includeArchivedRooms
);
return;
}
attempt = attempt || 1; attempt = attempt || 1;
client.pushRules().done(function(result) { client.pushRules().done(function(result) {
client.pushRules = result; client.pushRules = result;

View File

@@ -374,6 +374,10 @@ describe("MatrixClient", function() {
]; ];
it("should be set via setGuestRooms and used in /events calls", function(done) { it("should be set via setGuestRooms and used in /events calls", function(done) {
httpLookups = []; // no /pushrules
httpLookups.push({
method: "GET", path: "/initialSync", data: initialSyncData
});
httpLookups.push({ httpLookups.push({
method: "GET", method: "GET",
path: "/events", path: "/events",