mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
fix filters, and stop react exploding on unrecognised event tiles
This commit is contained in:
parent
8239e57fa1
commit
05d96f4cfb
@ -363,13 +363,10 @@ module.exports = {
|
|||||||
var filter;
|
var filter;
|
||||||
if (scope === "Room") { // FIXME: should be enum
|
if (scope === "Room") { // FIXME: should be enum
|
||||||
filter = {
|
filter = {
|
||||||
room: {
|
// XXX: it's unintuitive that the filter for searching doesn't have the same shape as the v2 filter API :(
|
||||||
timeline: {
|
rooms: [
|
||||||
rooms: [
|
this.props.roomId
|
||||||
this.props.roomId
|
]
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,16 +411,22 @@ module.exports = {
|
|||||||
var resultList = eventIds.map(function(key) { return results[key]; }).sort(function(a, b) { b.rank - a.rank });
|
var resultList = eventIds.map(function(key) { return results[key]; }).sort(function(a, b) { b.rank - a.rank });
|
||||||
for (var i = 0; i < resultList.length; i++) {
|
for (var i = 0; i < resultList.length; i++) {
|
||||||
var ts1 = resultList[i].result.origin_server_ts;
|
var ts1 = resultList[i].result.origin_server_ts;
|
||||||
ret.push(<li key={ts1}><DateSeparator ts={ts1}/></li>); // Rank: {resultList[i].rank}
|
ret.push(<li key={ts1 + "-search"}><DateSeparator ts={ts1}/></li>); // Rank: {resultList[i].rank}
|
||||||
var mxEv = new Matrix.MatrixEvent(resultList[i].result);
|
var mxEv = new Matrix.MatrixEvent(resultList[i].result);
|
||||||
if (resultList[i].context.events_before[0]) {
|
if (resultList[i].context.events_before[0]) {
|
||||||
var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_before[0]);
|
var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_before[0]);
|
||||||
ret.push(<li key={mxEv.getId() + "-1"}><EventTile mxEvent={mxEv2} contextual={true} /></li>);
|
if (EventTile.supportsEventType(mxEv2.getType())) {
|
||||||
|
ret.push(<li key={mxEv.getId() + "-1"}><EventTile mxEvent={mxEv2} contextual={true} /></li>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (EventTile.supportsEventType(mxEv.getType())) {
|
||||||
|
ret.push(<li key={mxEv.getId() + "+0"}><EventTile mxEvent={mxEv} searchTerm={this.state.searchTerm}/></li>);
|
||||||
}
|
}
|
||||||
ret.push(<li key={mxEv.getId() + "+0"}><EventTile mxEvent={mxEv} searchTerm={this.state.searchTerm}/></li>);
|
|
||||||
if (resultList[i].context.events_after[0]) {
|
if (resultList[i].context.events_after[0]) {
|
||||||
var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_after[0]);
|
var mxEv2 = new Matrix.MatrixEvent(resultList[i].context.events_after[0]);
|
||||||
ret.push(<li key={mxEv.getId() + "+1"}><EventTile mxEvent={mxEv2} contextual={true} /></li>);
|
if (EventTile.supportsEventType(mxEv2.getType())) {
|
||||||
|
ret.push(<li key={mxEv.getId() + "+1"}><EventTile mxEvent={mxEv2} contextual={true} /></li>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user