aboutsummaryrefslogtreecommitdiff
path: root/syncapi/internal
diff options
context:
space:
mode:
authorkegsay <kegan@matrix.org>2023-04-27 12:54:20 +0100
committerGitHub <noreply@github.com>2023-04-27 12:54:20 +0100
commitb189edf4f43ff34b69d6c60aeb0efb60dd549c86 (patch)
tree4c08aeda694f3e1cf17c66cf0e4b2b306af6a8df /syncapi/internal
parent2475cf4b61747e76a524af6f71a4eb7e112812af (diff)
Remove gmsl.HeaderedEvent (#3068)
Replaced with types.HeaderedEvent _for now_. In reality we want to move them all to gmsl.Event and only use HeaderedEvent when we _need_ to bundle the version/event ID with the event (seriailsation boundaries, and even then only when we don't have the room version). Requires https://github.com/matrix-org/gomatrixserverlib/pull/373
Diffstat (limited to 'syncapi/internal')
-rw-r--r--syncapi/internal/history_visibility.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/syncapi/internal/history_visibility.go b/syncapi/internal/history_visibility.go
index 10d7383b..7449b464 100644
--- a/syncapi/internal/history_visibility.go
+++ b/syncapi/internal/history_visibility.go
@@ -26,6 +26,7 @@ import (
"github.com/tidwall/gjson"
"github.com/matrix-org/dendrite/roomserver/api"
+ "github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/dendrite/syncapi/storage"
)
@@ -98,16 +99,16 @@ func (ev eventVisibility) allowed() (allowed bool) {
}
}
-// ApplyHistoryVisibilityFilter applies the room history visibility filter on gomatrixserverlib.HeaderedEvents.
+// ApplyHistoryVisibilityFilter applies the room history visibility filter on types.HeaderedEvents.
// Returns the filtered events and an error, if any.
func ApplyHistoryVisibilityFilter(
ctx context.Context,
syncDB storage.DatabaseTransaction,
rsAPI api.SyncRoomserverAPI,
- events []*gomatrixserverlib.HeaderedEvent,
+ events []*types.HeaderedEvent,
alwaysIncludeEventIDs map[string]struct{},
userID, endpoint string,
-) ([]*gomatrixserverlib.HeaderedEvent, error) {
+) ([]*types.HeaderedEvent, error) {
if len(events) == 0 {
return events, nil
}
@@ -120,7 +121,7 @@ func ApplyHistoryVisibilityFilter(
}
// Get the mapping from eventID -> eventVisibility
- eventsFiltered := make([]*gomatrixserverlib.HeaderedEvent, 0, len(events))
+ eventsFiltered := make([]*types.HeaderedEvent, 0, len(events))
visibilities := visibilityForEvents(ctx, rsAPI, events, userID, events[0].RoomID())
for _, ev := range events {
evVis := visibilities[ev.EventID()]
@@ -170,7 +171,7 @@ func ApplyHistoryVisibilityFilter(
func visibilityForEvents(
ctx context.Context,
rsAPI api.SyncRoomserverAPI,
- events []*gomatrixserverlib.HeaderedEvent,
+ events []*types.HeaderedEvent,
userID, roomID string,
) map[string]eventVisibility {
eventIDs := make([]string, len(events))