mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Nuke filtering for now...
This commit is contained in:
parent
4d80dff458
commit
b4e93a2a05
|
|
@ -95,11 +95,11 @@ const selectStateInRangeSQL = "" +
|
||||||
" FROM syncapi_output_room_events" +
|
" FROM syncapi_output_room_events" +
|
||||||
" WHERE (id > $1 AND id <= $2)" + // old/new pos
|
" WHERE (id > $1 AND id <= $2)" + // old/new pos
|
||||||
" AND (add_state_ids IS NOT NULL OR remove_state_ids IS NOT NULL)" +
|
" AND (add_state_ids IS NOT NULL OR remove_state_ids IS NOT NULL)" +
|
||||||
" AND ( $3 IS NULL OR sender IN ($3) )" + // sender
|
/* " AND ( $3 IS NULL OR sender IN ($3) )" + // sender
|
||||||
" AND ( $4 IS NULL OR NOT(sender IN ($4)) )" + // not sender
|
" AND ( $4 IS NULL OR NOT(sender IN ($4)) )" + // not sender
|
||||||
" AND ( $5 IS NULL OR type IN ($5) )" + // type
|
" AND ( $5 IS NULL OR type IN ($5) )" + // type
|
||||||
" AND ( $6 IS NULL OR NOT(type IN ($6)) )" + // not type
|
" AND ( $6 IS NULL OR NOT(type IN ($6)) )" + // not type
|
||||||
" AND ( $7 IS NULL OR contains_url = $7)" + // contains URL?
|
" AND ( $7 IS NULL OR contains_url = $7)" + // contains URL? */
|
||||||
" ORDER BY id ASC" +
|
" ORDER BY id ASC" +
|
||||||
" LIMIT $8" // limit
|
" LIMIT $8" // limit
|
||||||
|
|
||||||
|
|
@ -159,11 +159,11 @@ func (s *outputRoomEventsStatements) selectStateInRange(
|
||||||
|
|
||||||
rows, err := stmt.QueryContext(
|
rows, err := stmt.QueryContext(
|
||||||
ctx, oldPos, newPos,
|
ctx, oldPos, newPos,
|
||||||
pq.StringArray(stateFilterPart.Senders),
|
/*pq.StringArray(stateFilterPart.Senders),
|
||||||
pq.StringArray(stateFilterPart.NotSenders),
|
pq.StringArray(stateFilterPart.NotSenders),
|
||||||
pq.StringArray(filterConvertTypeWildcardToSQL(stateFilterPart.Types)),
|
pq.StringArray(filterConvertTypeWildcardToSQL(stateFilterPart.Types)),
|
||||||
pq.StringArray(filterConvertTypeWildcardToSQL(stateFilterPart.NotTypes)),
|
pq.StringArray(filterConvertTypeWildcardToSQL(stateFilterPart.NotTypes)),
|
||||||
stateFilterPart.ContainsURL,
|
stateFilterPart.ContainsURL,*/
|
||||||
stateFilterPart.Limit,
|
stateFilterPart.Limit,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -611,16 +611,21 @@ func (d *SyncServerDatasource) getResponseWithPDUsForCompleteSync(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
fmt.Println("Joined rooms:", joinedRoomIDs)
|
||||||
|
|
||||||
stateFilterPart := gomatrix.DefaultFilterPart() // TODO: use filter provided in request
|
stateFilterPart := gomatrix.DefaultFilterPart() // TODO: use filter provided in request
|
||||||
|
|
||||||
// Build up a /sync response. Add joined rooms.
|
// Build up a /sync response. Add joined rooms.
|
||||||
for _, roomID := range joinedRoomIDs {
|
for _, roomID := range joinedRoomIDs {
|
||||||
|
fmt.Println("WE'RE ON", roomID)
|
||||||
|
|
||||||
var stateEvents []gomatrixserverlib.Event
|
var stateEvents []gomatrixserverlib.Event
|
||||||
stateEvents, err = d.roomstate.selectCurrentState(ctx, txn, roomID, &stateFilterPart)
|
stateEvents, err = d.roomstate.selectCurrentState(ctx, txn, roomID, &stateFilterPart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("d.roomstate.selectCurrentState:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//fmt.Println("State events:", stateEvents)
|
||||||
// TODO: When filters are added, we may need to call this multiple times to get enough events.
|
// TODO: When filters are added, we may need to call this multiple times to get enough events.
|
||||||
// See: https://github.com/matrix-org/synapse/blob/v0.19.3/synapse/handlers/sync.py#L316
|
// See: https://github.com/matrix-org/synapse/blob/v0.19.3/synapse/handlers/sync.py#L316
|
||||||
var recentStreamEvents []types.StreamEvent
|
var recentStreamEvents []types.StreamEvent
|
||||||
|
|
@ -629,16 +634,20 @@ func (d *SyncServerDatasource) getResponseWithPDUsForCompleteSync(
|
||||||
numRecentEventsPerRoom, true, true,
|
numRecentEventsPerRoom, true, true,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("d.events.selectRecentEvents:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//fmt.Println("Recent stream events:", recentStreamEvents)
|
||||||
|
|
||||||
// Retrieve the backward topology position, i.e. the position of the
|
// Retrieve the backward topology position, i.e. the position of the
|
||||||
// oldest event in the room's topology.
|
// oldest event in the room's topology.
|
||||||
var backwardTopologyPos types.StreamPosition
|
var backwardTopologyPos types.StreamPosition
|
||||||
backwardTopologyPos, err = d.topology.selectPositionInTopology(ctx, txn, recentStreamEvents[0].EventID())
|
backwardTopologyPos, err = d.topology.selectPositionInTopology(ctx, txn, recentStreamEvents[0].EventID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("d.topology.selectPositionInTopology:", err)
|
||||||
return nil, types.PaginationToken{}, []string{}, err
|
return nil, types.PaginationToken{}, []string{}, err
|
||||||
}
|
}
|
||||||
|
fmt.Println("Backward topology position:", backwardTopologyPos)
|
||||||
if backwardTopologyPos-1 <= 0 {
|
if backwardTopologyPos-1 <= 0 {
|
||||||
backwardTopologyPos = types.StreamPosition(1)
|
backwardTopologyPos = types.StreamPosition(1)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -660,6 +669,7 @@ func (d *SyncServerDatasource) getResponseWithPDUsForCompleteSync(
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = d.addInvitesToResponse(ctx, txn, userID, 0, toPos.PDUPosition, res); err != nil {
|
if err = d.addInvitesToResponse(ctx, txn, userID, 0, toPos.PDUPosition, res); err != nil {
|
||||||
|
fmt.Println("d.addInvitesToResponse:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue