diff --git a/syncapi/storage/postgres/invites_table.go b/syncapi/storage/postgres/invites_table.go index 576b2cf7d..97001ae2c 100644 --- a/syncapi/storage/postgres/invites_table.go +++ b/syncapi/storage/postgres/invites_table.go @@ -20,12 +20,11 @@ import ( "database/sql" "encoding/json" - "github.com/matrix-org/gomatrixserverlib" - "github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal/sqlutil" "github.com/matrix-org/dendrite/syncapi/storage/tables" "github.com/matrix-org/dendrite/syncapi/types" + "github.com/matrix-org/gomatrixserverlib" ) const inviteEventsSchema = ` @@ -57,7 +56,7 @@ const deleteInviteEventSQL = "" + const selectInviteEventsInRangeSQL = "" + "SELECT room_id, headered_event_json, deleted FROM syncapi_invite_events" + - " WHERE target_user_id = $1 AND id > $2 AND id <= $3 AND deleted = false" + + " WHERE target_user_id = $1 AND id > $2 AND id <= $3" + " ORDER BY id DESC" const selectMaxInviteIDSQL = "" + diff --git a/syncapi/storage/sqlite3/invites_table.go b/syncapi/storage/sqlite3/invites_table.go index 9f2812979..58ab8461e 100644 --- a/syncapi/storage/sqlite3/invites_table.go +++ b/syncapi/storage/sqlite3/invites_table.go @@ -20,12 +20,11 @@ import ( "database/sql" "encoding/json" - "github.com/matrix-org/gomatrixserverlib" - "github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal/sqlutil" "github.com/matrix-org/dendrite/syncapi/storage/tables" "github.com/matrix-org/dendrite/syncapi/types" + "github.com/matrix-org/gomatrixserverlib" ) const inviteEventsSchema = ` @@ -52,7 +51,7 @@ const deleteInviteEventSQL = "" + const selectInviteEventsInRangeSQL = "" + "SELECT room_id, headered_event_json, deleted FROM syncapi_invite_events" + - " WHERE target_user_id = $1 AND id > $2 AND id <= $3 AND deleted = false" + + " WHERE target_user_id = $1 AND id > $2 AND id <= $3" + " ORDER BY id DESC" const selectMaxInviteIDSQL = "" +