Skip to content
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

Use stable identifiers from MSC3706 (Faster joins) #350

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion federationclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (ac *FederationClient) sendJoin(
url.PathEscape(event.RoomID()) + "/" +
url.PathEscape(event.EventID())
if partialState {
path += "?org.matrix.msc3706.partial_state=true"
path += "?omit_members=true"
}

req := NewFederationRequest("PUT", origin, s, path)
Expand Down
8 changes: 4 additions & 4 deletions federationtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ type RespSendJoin struct {
// but not guaranteed to be present as it's only since MSC3083.
Event RawJSON `json:"event,omitempty"`
// true if the state is incomplete
PartialState bool `json:"org.matrix.msc3706.partial_state"`
PartialState bool `json:"members_omitted"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda wonder if we should rename the struct field while we're here. It'll break compatibility with any apps using it, but there doesn't seem to be any advantage to delaying it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the done thing is in GMSL, but I'm persuaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See d5bef8c

// a list of servers in the room. Only returned if partial_state is set.
ServersInRoom []string `json:"org.matrix.msc3706.servers_in_room"`
ServersInRoom []string `json:"servers_in_room"`
}

// MarshalJSON implements json.Marshaller
Expand Down Expand Up @@ -517,8 +517,8 @@ type respSendJoinFields struct {
// when the response has incomplete state.
type respSendJoinPartialStateFields struct {
respSendJoinFields
PartialState bool `json:"org.matrix.msc3706.partial_state"`
ServersInRoom []string `json:"org.matrix.msc3706.servers_in_room"`
PartialState bool `json:"members_omitted"`
ServersInRoom []string `json:"servers_in_room"`
}

// ToRespState returns a new RespState with the same data from the given RespSendJoin
Expand Down
4 changes: 2 additions & 2 deletions federationtypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func TestRespSendJoinMarshalJSON(t *testing.T) {
func TestRespSendJoinMarshalJSONPartialState(t *testing.T) {
inputData := `{
"state":[],"auth_chain":[],"origin":"o1",
"org.matrix.msc3706.partial_state":true,
"org.matrix.msc3706.servers_in_room":["s1", "s2"]
"members_omitted":true,
"servers_in_room":["s1", "s2"]
}`

var input RespSendJoin
Expand Down