-
-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Implement archived rooms (include_leave filter on /sync) #1671
Conversation
88c0656
to
61740f9
Compare
ab5da23
to
9a7f6e4
Compare
225b98c
to
634ca4e
Compare
@kegsay Can you do a once over review on this to sanity check, make sure I am not doing something the hard way or should go at a different angle? I just have the |
d6796e1
to
29c697f
Compare
b66ae00
to
783fba2
Compare
syncapi/streams/stream_pdu.go
Outdated
// TODO: How do we apply filter.Room.State to this as well? | ||
// Is there a generic function where we can pass a list of events and filter and get the result? | ||
// This is based off of Synapse where we derive the state from the resultant timeline events | ||
// https://github.com/matrix-org/synapse/blob/14950a45d6ff3a5ea737322af1096a49b079f2eb/synapse/handlers/sync.py#L791-L795 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neilalexander Do you know of a utility function to accomplish this?
Maybe I'm going about this wrong? Should I be doing the filterStreamEventsAccordingToHistoryVisibility
filtering in p.DB.RecentEvents(...)
call and that will setup the state to come out correct with p.DB.CurrentState(...)
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering when we select the events is probably the way to go. Related to #1671 (comment)
78f77c0
to
fe7acc6
Compare
As an update here, @neilalexander is going to take a look at adding |
Edits while working on matrix-org/dendrite#1671
Type filtering now available thanks to @neilalexander via #1721 🚀 Will merge that in here and see how far I get! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see, this code will continue to serve live events for rooms the user has left. We need to be limiting the max stream position (types.Range
) to the leave event of the user at the very very least. That still isn't ideal since it'll leak events between a join->leave->join->leave in a single request (which if it's a complete sync will be the entire room.
@@ -85,6 +84,28 @@ func (p *PDUStreamProvider) CompleteSync( | |||
} | |||
} | |||
|
|||
if req.Filter.Room.IncludeLeave { | |||
var leaveRoomIDs []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're :=
on :90
this line is spurious.
return recentStreamEvents[sliceStart:sliceEnd], limited | ||
} | ||
|
||
func removeDuplicates(stateEvents, recentEvents []*gomatrixserverlib.HeaderedEvent) []*gomatrixserverlib.HeaderedEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear which slice will have dupes removed from. Please document this.
What's the status on this PR @MadLittleMods ? |
@kegsay It's definitely stale but it's still in my browser tabs. From #1323 (comment), "Might require better/full history visibility implementation" if we want to handle the Otherwise, may just need to give this some time again to get it back in shape. |
Please re-open this PR against latest master. Until then, closing it so it isn't constantly outstanding on our open PR list. |
Implement archived rooms (
include_leave
filter on/sync
)Fix #1323
Dev notes
GET /_matrix/client/r0/sync
(seefilter
query parameter), https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-syncPOST /_matrix/client/r0/user/{userId}/filter
(RoomFilter
hasinclude_leave
), https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-user-userid-filtersyncapi/routing/routing.go#L45-L47
syncapi/sync/requestpool.go#L127-L225
filter
query parameter is handled:syncapi/sync/request.go#L67-L89
syncapi/storage/shared/syncserver.go#L803
syncapi/types/types.go#L459-L469
->LeaveResponse
filter.go#L120-L135
->gomatrixserverlib.DefaultStateFilter()
eventauth.go#L33-L34
Internal doc about getting started developing on dendrite: https://docs.google.com/document/d/14USwq1faRk7I2m_LacBUipFGF0-hdrglmiFpiNeGM5o/edit
Internal doc syncing on this PR: https://docs.google.com/document/d/1F3EKyzZL5xOP2GQuqmC6H3BhYESXCLjUEPNEW_dMO94/edit
cmd/client-api-proxy/main.go#L147
Sytest
tests/31sync/09archived.pl#L306-L391
docs/dendrite-setup.md
dumping the events
Todo
CompleteSync
IncrementalSync
This will fail on join -> leave -> sensitive msg -> join -> leave
?Pull Request Checklist
sytest-whitelist
as specified in docs/sytest.mdSigned-off-by:
Your Name <your@email.example.org>