Remove scrollDownMessageHeight. Fix failing test
This commit is contained in:
parent
0bc0072fea
commit
f24e7c0905
@ -699,7 +699,7 @@
|
|||||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
waits(50);
|
waits(500); // Give enough time for `markScrolled` to have been called
|
||||||
runs(function () {
|
runs(function () {
|
||||||
chatboxview.$content.scrollTop(0);
|
chatboxview.$content.scrollTop(0);
|
||||||
});
|
});
|
||||||
|
@ -1101,7 +1101,7 @@
|
|||||||
}).c('body').t('Message: '+i).tree());
|
}).c('body').t('Message: '+i).tree());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
waits(50);
|
waits(500); // Give enough time for `markScrolled` to have been called
|
||||||
runs(function () {
|
runs(function () {
|
||||||
view.$content.scrollTop(0);
|
view.$content.scrollTop(0);
|
||||||
});
|
});
|
||||||
|
@ -221,7 +221,7 @@
|
|||||||
insert.call(that.$content, $el);
|
insert.call(that.$content, $el);
|
||||||
return $el;
|
return $el;
|
||||||
},
|
},
|
||||||
this.scrollDownMessageHeight.bind(this)
|
this.scrollDown.bind(this)
|
||||||
)(this.renderMessage(attrs));
|
)(this.renderMessage(attrs));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -288,7 +288,7 @@
|
|||||||
this.$content.find('.chat-message[data-isodate="'+msg_dates[idx]+'"]'));
|
this.$content.find('.chat-message[data-isodate="'+msg_dates[idx]+'"]'));
|
||||||
return $el;
|
return $el;
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
this.scrollDownMessageHeight.bind(this)
|
this.scrollDown.bind(this)
|
||||||
)(this.renderMessage(attrs));
|
)(this.renderMessage(attrs));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -776,6 +776,13 @@
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideNewMessagesIndicator: function () {
|
||||||
|
var new_msgs_indicator = this.el.querySelector('.new-msgs-indicator');
|
||||||
|
if (!_.isNull(new_msgs_indicator)) {
|
||||||
|
new_msgs_indicator.classList.add('hidden');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
markScrolled: _.debounce(function (ev) {
|
markScrolled: _.debounce(function (ev) {
|
||||||
/* Called when the chat content is scrolled up or down.
|
/* Called when the chat content is scrolled up or down.
|
||||||
* We want to record when the user has scrolled away from
|
* We want to record when the user has scrolled away from
|
||||||
@ -795,8 +802,8 @@
|
|||||||
(this.$content.scrollTop() + this.$content.innerHeight()) >=
|
(this.$content.scrollTop() + this.$content.innerHeight()) >=
|
||||||
this.$content[0].scrollHeight-10;
|
this.$content[0].scrollHeight-10;
|
||||||
if (is_at_bottom) {
|
if (is_at_bottom) {
|
||||||
|
this.hideNewMessagesIndicator();
|
||||||
this.model.save('scrolled', false);
|
this.model.save('scrolled', false);
|
||||||
this.$el.find('.new-msgs-indicator').addClass('hidden');
|
|
||||||
} else {
|
} else {
|
||||||
// We're not at the bottom of the chat area, so we mark
|
// We're not at the bottom of the chat area, so we mark
|
||||||
// that the box is in a scrolled-up state.
|
// that the box is in a scrolled-up state.
|
||||||
@ -809,20 +816,11 @@
|
|||||||
this.scrollDown();
|
this.scrollDown();
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollDownMessageHeight: function ($message) {
|
|
||||||
if (this.$content.is(':visible') && !this.model.get('scrolled')) {
|
|
||||||
this.$content.scrollTop(
|
|
||||||
this.$content.scrollTop() + $message[0].scrollHeight);
|
|
||||||
this.model.save({'auto_scrolled': true});
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
_scrollDown: function () {
|
_scrollDown: function () {
|
||||||
/* Inner method that gets debounced */
|
/* Inner method that gets debounced */
|
||||||
if (this.$content.is(':visible') && !this.model.get('scrolled')) {
|
if (this.$content.is(':visible') && !this.model.get('scrolled')) {
|
||||||
this.$content.scrollTop(this.$content[0].scrollHeight);
|
this.$content.scrollTop(this.$content[0].scrollHeight);
|
||||||
this.$el.find('.new-msgs-indicator').addClass('hidden');
|
this.hideNewMessagesIndicator();
|
||||||
this.model.save({'auto_scrolled': true});
|
this.model.save({'auto_scrolled': true});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user