Support limit and feedback param of initialSync
parent
c585c87c4b
commit
e40d829363
|
@ -106,11 +106,20 @@ angular.module('matrixService', [])
|
||||||
},
|
},
|
||||||
|
|
||||||
// List all rooms joined or been invited to
|
// List all rooms joined or been invited to
|
||||||
rooms: function(from, to, limit) {
|
rooms: function(limit, feedback) {
|
||||||
// The REST path spec
|
// The REST path spec
|
||||||
|
|
||||||
var path = "/initialSync";
|
var path = "/initialSync";
|
||||||
|
|
||||||
return doRequest("GET", path);
|
var params = {};
|
||||||
|
if (limit) {
|
||||||
|
params.limit = limit;
|
||||||
|
}
|
||||||
|
if (feedback) {
|
||||||
|
params.feedback = feedback;
|
||||||
|
}
|
||||||
|
|
||||||
|
return doRequest("GET", path, params);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Joins a room
|
// Joins a room
|
||||||
|
|
|
@ -78,12 +78,15 @@ angular.module('HomeController', ['matrixService', 'mFileInput', 'mFileUpload',
|
||||||
|
|
||||||
var refresh = function() {
|
var refresh = function() {
|
||||||
// List all rooms joined or been invited to
|
// List all rooms joined or been invited to
|
||||||
matrixService.rooms(1,true).then(
|
matrixService.rooms(1, false).then(
|
||||||
function(response) {
|
function(response) {
|
||||||
var data = assignRoomAliases(response.data.rooms);
|
var data = assignRoomAliases(response.data.rooms);
|
||||||
$scope.feedback = "Success";
|
$scope.feedback = "Success";
|
||||||
for (var i=0; i<data.length; i++) {
|
for (var i=0; i<data.length; i++) {
|
||||||
$scope.rooms[data[i].room_id] = data[i];
|
$scope.rooms[data[i].room_id] = data[i];
|
||||||
|
|
||||||
|
// Create a shortcut for the last message of this room
|
||||||
|
$scope.rooms[data[i].room_id].lastMsg = data[i].messages.chunk[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var presence = response.data.presence;
|
var presence = response.data.presence;
|
||||||
|
|
Loading…
Reference in New Issue