Skip to content

Commit

Permalink
Merge pull request #103 from modoboa/fix/pagination
Browse files Browse the repository at this point in the history
Be careful with closures...
  • Loading branch information
tonioo committed Sep 21, 2017
2 parents 5a6261a + 4a1a1c0 commit 5dbb203
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions modoboa_webmail/static/modoboa_webmail/js/webmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ Webmail.prototype = {
*/
setup_infinite_scroll: function(data) {
var $container = $('#listing');
var that = this;
var currentMb = this.get_current_mailbox();

if ($container.data('infinite-scroll') !== undefined) {
if (data.pages && data.pages[0] !== 1) {
Expand All @@ -183,11 +181,12 @@ Webmail.prototype = {
calculate_bottom: function($element) {
return $('#emails').height() - $element.height();
},
get_args: function() {
var args = $.extend({}, {mbox: currentMb}, that.navparams);
get_args: $.proxy(function() {
var currentMb = this.get_current_mailbox();
var args = $.extend({}, {mbox: currentMb}, this.navparams);
args.scroll = true;
return args;
},
}, this),
process_results: function(data, direction) {
var $emails = $('#emails');

Expand Down

0 comments on commit 5dbb203

Please sign in to comment.