Skip to content

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

Merged
bmarty merged 2 commits intodevelopfrom
feature/bca/room_summary_api
Sep 15, 2021
Merged

Better room preview, use room Summary API if available#3986
bmarty merged 2 commits intodevelopfrom
feature/bca/room_summary_api

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?

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