Limit the number of messages we load into a chat room when we switch to it (or more accurately, switch back to it).
This commit is contained in:
parent
2355d5e6b5
commit
209e052025
2 changed files with 28 additions and 12 deletions
|
@ -38,11 +38,16 @@ module.exports = React.createClass({
|
|||
mixins: [RoomViewController],
|
||||
|
||||
getMessageTiles: function() {
|
||||
return this.state.room.timeline.map(function(mxEv) {
|
||||
return (
|
||||
var ret = [];
|
||||
var count = 0;
|
||||
for (var i = this.state.room.timeline.length-1; i >= 0 && count < this.state.messageCap; --i) {
|
||||
var mxEv = this.state.room.timeline[i];
|
||||
ret.unshift(
|
||||
<li key={mxEv.getId()}><MessageTile mxEvent={mxEv} /></li>
|
||||
);
|
||||
});
|
||||
++count;
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue