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 the stable hierarcy endpoint from MSC2946 #5144

Closed
clokep opened this issue Nov 12, 2021 · 6 comments · Fixed by matrix-org/matrix-ios-sdk#1415
Closed

Use the stable hierarcy endpoint from MSC2946 #5144

clokep opened this issue Nov 12, 2021 · 6 comments · Fixed by matrix-org/matrix-ios-sdk#1415
Labels
A-SDK A-Spaces Spaces, groups, communities T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements

Comments

@clokep
Copy link

clokep commented Nov 12, 2021

MSC2946 has completed FCP and Synapse is implementing the stable endpoint (see matrix-org/synapse#11329). It would be nice for Element iOS to implement the following so that the unstable endpoints can be deprecated:

  • Start using the stable /_matrix/client/v1/rooms/{roomID}/hierarchy endpoint.
  • Ensure that the room_id is not accessed via the list of children_state (this is nested under the room information and should be unnecesary).

This should most likely be implemented to attempt using the stable endpoint before falling back to the unstable endpoint. Please let me know if you have any questions.

@clokep clokep added the A-Spaces Spaces, groups, communities label Nov 12, 2021
@RiotRobot RiotRobot added this to Incoming in Issue triage Nov 12, 2021
@pixlwave pixlwave added T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements A-Spaces Spaces, groups, communities and removed A-Spaces Spaces, groups, communities labels Nov 22, 2021
@RiotRobot RiotRobot moved this from Incoming to Triaged in Issue triage Nov 22, 2021
@pixlwave pixlwave added the A-SDK label Nov 22, 2021
@clokep
Copy link
Author

clokep commented Mar 8, 2022

The other thing to check is if the join_rules field (plural version) is being used instead of the proper join_rule field.

@gileluard
Copy link
Contributor

@clokep I can do it I'm just wondering what you mean about:

Ensure that the room_id is not accessed via the list of children_state (this is nested under the room information and should be unnecesary).

Here is my use case:

ezgif-1-8aec4842eb

To get the list of children for Matrix Community we call the /hierarchy endpoint with the room ID of the Matrix Community space. Then, if I tap Other Projects, the app takes the room ID of Other Projects from the result of the hierarchy previous request and perform a new /hierarchy request with the room ID of Other Projects. Is it fine from the API standpoint?

@clokep
Copy link
Author

clokep commented Mar 18, 2022

Is it fine from the API standpoint?

Yes, it should work, it might be inefficient, however. Are you calling the API with a max-depth? By default the API will paginate through the entire tree of spaces.


Ensure that the room_id is not accessed via the list of children_state (this is nested under the room information and should be unnecesary).

This is referencing a minor change to the API shape that gets returned. If we use the example from the spec, I've highlighted the field that was removed:

 {
   "next_batch": "next_batch_token",
   "rooms": [
     {
       "avatar_url": "mxc://example.org/abcdef",
       "canonical_alias": "#general:example.org",
       "children_state": [
         {
           "content": {
             "via": [
               "example.org"
             ]
           },
-          "room_id": "!space:example.org",
           "origin_server_ts": 1629413349153,
           "sender": "@alice:example.org",
           "state_key": "!a:example.org",
           "type": "m.space.child"
         }
       ],
       "guest_can_join": false,
       "join_rule": "public",
       "name": "The First Space",
       "num_joined_members": 42,
       "room_id": "!space:example.org",
       "room_type": "m.space",
       "topic": "No other spaces were created first, ever",
       "world_readable": true
     }
   ]
 }

@gileluard
Copy link
Contributor

Thanks for your answer. We actually call the API with a max-depth=1 as we want a maximum of direct children for the current space.

@clokep
Copy link
Author

clokep commented Mar 18, 2022

Then yes, that should work fine!

@clokep
Copy link
Author

clokep commented Aug 15, 2022

It seems the room_id was still being used from the children_state, see #6547 for a crash due to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-SDK A-Spaces Spaces, groups, communities T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
Development

Successfully merging a pull request may close this issue.

3 participants