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

Better room preview, use room Summary API if available #3986

Merged
merged 2 commits into from
Sep 15, 2021

Conversation

BillCarsonFr
Copy link
Member

Fixes #3946

Implements MSC 3266

Improve Room preview by using the new Room Summary API (stripped state). This allows you to get minimum information on a room (name/topic/avatar/type/member count...) even if you cannot peek state or if it's not in public directory.
Basically if you can join the room you will get a summary.

@BillCarsonFr BillCarsonFr added A-Spaces Spaces, groups, communities Z-NextRelease For issues and PRs which should be included in the NextRelease. labels Sep 8, 2021
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, just a few minor remarks


override suspend fun execute(params: GetRoomSummaryTask.Params): RoomStrippedState {
return executeRequest(globalErrorReceiver) {
roomAPI.getRoomSummary(params.roomId, params.viaServers)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any fallback if this unstable API returns a 404? This can occur a lot.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's done in PeekRoom task. It will try first the summary API, then check the public repository, and fallback to raw peek state if no results

* as well as if the user is already a member of that room.
* https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "im.nheko.summary/rooms/{roomidOrAlias}/summary")
Copy link
Member

Choose a reason for hiding this comment

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

I know it is like that in the MSC, I've made a comment about it, but here, can you write roomIdOrAlias, with a capital I please?

@@ -253,4 +253,7 @@ internal abstract class RoomModule {

@Binds
abstract fun bindSign3pidInvitationTask(task: DefaultSign3pidInvitationTask): Sign3pidInvitationTask

@Binds
abstract fun bindSGetRoomSummaryTask(task: DefaultGetRoomSummaryTask): GetRoomSummaryTask
Copy link
Member

Choose a reason for hiding this comment

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

Remove the extra "S"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@github-actions
Copy link

github-actions bot commented Sep 15, 2021

Unit Test Results

  34 files  ±0    34 suites  ±0   20s ⏱️ ±0s
  73 tests ±0    73 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
180 runs  ±0  180 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d6b261c. ± Comparison against base commit d6b261c.

♻️ This comment has been updated with latest results.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Spaces Spaces, groups, communities Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restricted Room previews aren't working
2 participants