diff --git a/lib/client.js b/lib/client.js index 9fc843730..9c992e642 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1719,9 +1719,12 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) { return pendingRequest; } + var path, params, promise; + var self = this; + if (isNotifTimeline) { - var path = "/notifications"; - var params = { + path = "/notifications"; + params = { limit: ('limit' in opts) ? opts.limit : 30, only: 'highlight', }; @@ -1730,8 +1733,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) { params.token = token; } - var self = this; - var promise = + promise = this._http.authedRequestWithPrefix(undefined, "GET", path, params, undefined, httpApi.PREFIX_UNSTABLE ).then(function(res) { @@ -1769,10 +1771,10 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) { throw new Error("Unknown room " + eventTimeline.getRoomId()); } - var path = utils.encodeUri( + path = utils.encodeUri( "/rooms/$roomId/messages", {$roomId: eventTimeline.getRoomId()} ); - var params = { + params = { from: token, limit: ('limit' in opts) ? opts.limit : 30, dir: dir @@ -1785,9 +1787,7 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) { params.filter = JSON.stringify(filter.getRoomTimelineFilterComponent()); } - var self = this; - - var promise = + promise = this._http.authedRequest(undefined, "GET", path, params ).then(function(res) { var token = res.end;