Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Show knock rooms in the list #11573

Merged
merged 12 commits into from
Sep 19, 2023
Merged

Show knock rooms in the list #11573

merged 12 commits into from
Sep 19, 2023

Conversation

maheichyk
Copy link
Contributor

@maheichyk maheichyk commented Sep 6, 2023

We @nordeck are currently implementing the knock rooms behind the feature flag feature_ask_to_join (introduced in #11182).

This PR allows to see knocked rooms in the rooms list. Knock rooms have incon/notification showing the knock request status.

Epic: vector-im/element-web/issues/18655

Videos:

knock_approve.mp4
knock_cancel.mp4
knock_forget.mp4

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Type: enhancement


Here's what your changelog entry will look like:

✨ Features

@github-actions github-actions bot added Z-Community-PR Issue is solved by a community member's PR T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements labels Sep 6, 2023
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
@daniellekirkwood
Copy link

the videos are helpful, thank you. Generally, this looks fine to me although I don't expect the user to have to "accept" a join invite once their knock has been granted.

In the first video the room is in the room list with the hand icon which is great but once 'accepted' the room jumps to the invite list and when clicking on it their asked to join the room?

@maheichyk
Copy link
Contributor Author

@daniellekirkwood Yes, it happens because in order to add the user into the room we need to invite him first, although the user has already knocked. Synapse by default doesn't auto-accept the invitation and in this use case it would be really nice. Currently this auto-accept behavior should be possible via custom synapse module or widget. I think it is a very good point.

@maheichyk
Copy link
Contributor Author

@daniellekirkwood another option could be to auto-accept these invites from Element client, but this should be done as a separate PR.

@maheichyk
Copy link
Contributor Author

@t3chguy, @richvdh could you please review?

@daniellekirkwood
Copy link

@daniellekirkwood another option could be to auto-accept these invites from Element client, but this should be done as a separate PR.

that would be great, thank you

@weeman1337 weeman1337 self-requested a review September 11, 2023 11:43
Copy link
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @maheichyk .

Unfortunately it seems like we get „stuck rooms“ with this PR:

image

All of those rooms with the hand are either rejected knocks or rooms that I've forgotten.

You can reproduce it by

  • User A: Knock at a room
  • User B: Reject
  • User A: Sees the red badge
  • User A: Reload (probably several times)
  • User A has now a stuck room

Also rooms that I've discarded from the archive tend to reappear. Just reload the app several times.

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
@maheichyk
Copy link
Contributor Author

maheichyk commented Sep 19, 2023

@weeman1337 thanks for the issue. Could you please clarify the expected behavior here: are rejected rooms supposed to disappear completely on this step or are they expected to be there but with reject icon (until user explicitly forgets the room)?

For the case above I would expect the room to keep the notification until I dismiss it on my side. Currently, after reload, it looks like a knocked-at-room at again.

The other case I was able to identify is after you dismissed a room where you have knocked at, it will go to archive. If you forget the room there and reload the app these rooms reappear as knocked-at-rooms in the room list. Here I would expect to never see the room again.

@weeman1337 matrix-js-sdk was changed to delete knocked rooms when knock membership changes, so if knock request is approved, cancelled or rejected, then the room is deleted from knocked rooms stored in the DB.

This change fixes the issue that knocks were "stuck". At the moment denied knocks will disappear after some time if Element is reloaded several times, but this is probably okay for initial implementation (@daniellekirkwood please correct me if I am wrong here), because there is some uncertainty how to implement this correctly and would be nice to improve it in separate PR.

It would be nice to move this PR forward.

@weeman1337
Copy link
Contributor

Thank you for working further on this @maheichyk Unfortunately the issue seems still to exist:

Peek 2023-09-19 09-04

I can see two errors in console. Probably this helps:

M_FORBIDDEN: MatrixError: [403] User @michael_test123:matrix.org not allowed to view events in room !fcxEbolLGVYuvOYLFz:matrix.org at token StreamToken(room_key=RoomStreamToken(topological=None, stream=4319719337, instance_map=immutabledict({})), presence_key=757284974, typing_key=17851800, receipt_key=2360235631, account_data_key=2467556192, push_rules_key=4593358, to_device_key=1046202977, device_list_key=8426059873, groups_key=0, un_partial_stated_rooms_key=172948) (https://matrix-client.matrix.org/_matrix/client/v3/rooms/!fcxEbolLGVYuvOYLFz%3Amatrix.org/members?not_membership=leave&at=s4319719337_757284974_17851800_2360235631_2467556192_4593358_1046202977_8426059873_0_172948)
    HTTPError errors.ts:34
    MatrixError errors.ts:63
    parseErrorResponse utils.ts:83
    requestOtherUrl fetch.ts:294
    request fetch.ts:204
    authedRequest fetch.ts:155
    members client.ts:8152
    loadMembersFromServer room.ts:961
    loadMembers room.ts:976
    loadMembersIfNeeded room.ts:1015
    getEncryptionTargetMembers room.ts:1714
    shieldStatusForRoom ShieldUtils.ts:35
    updateE2EStatus RoomView.tsx:1518
    RoomView_RoomView RoomView.tsx:1393
    RoomView_RoomView RoomView.tsx:770
    componentDidMount RoomView.tsx:962
    React 2
    unstable_runWithPriority scheduler.production.min.js:18
    React 4
    unstable_runWithPriority scheduler.production.min.js:18
    React 6
    setState MatrixChat.tsx:475
    viewRoom MatrixChat.tsx:1053
    MatrixChat MatrixChat.tsx:758
    invokeCallback dispatcher.ts:120
    MatrixDispatcher dispatcher.ts:97
    setTimeout handler*dispatch dispatcher.ts:170
    RoomTile RoomTile.tsx:241
    React 11
    unstable_runWithPriority scheduler.production.min.js:18
    React 3
Tried to remove unknown room from im.vector.fake.recent: !fcxEbolLGVYuvOYLFz:matrix.org

@weeman1337
Copy link
Contributor

because there is some uncertainty how to implement this correctly and would be nice to improve it in separate PR.

What about removing the room from the client if it is discarded from the ui?

If this goes to a separate issue can you please create one and link it to the epic?

@weeman1337
Copy link
Contributor

Another issue is that the room does sometimes not appear in the list:

Peek 2023-09-19 09-32

There are some log items:

!fcxEbolLGVYuvOYLFz:matrix.org is current in RVS but missing from client - clearing sticky room [rageshake.ts:74:27](webpack:///src/rageshake/rageshake.ts)
Got room state event for unknown room !fcxEbolLGVYuvOYLFz:matrix.org! 5 [rageshake.ts:74:27](webpack:///src/rageshake/rageshake.ts)
    fnName rageshake.ts:74
    instrumentConsole instrument.js:124
    methodFactory logger.ts:48
    MatrixRTCSessionManager_MatrixRTCSessionManager MatrixRTCSessionManager.ts:105
    emit events.js:158
    emit typed-event-emitter.ts:89
    forSource ReEmitter.ts:55
    emit events.js:153
    emit typed-event-emitter.ts:89
    forSource ReEmitter.ts:55
    emit events.js:153
    emit typed-event-emitter.ts:89
    setStateEvents room-state.ts:415
    setStateEvents room-state.ts:402
    initialiseState event-timeline.ts:156
    injectRoomEvents sync.ts:1788
    processSyncResponse sync.ts:1524
    promiseMapSeries utils.ts:425
!fcxEbolLGVYuvOYLFz:matrix.org is reportedly new but is already known - assuming TagChange instead [rageshake.ts:74:27](webpack:///src/rageshake/rageshake.ts)
!fcxEbolLGVYuvOYLFz:matrix.org might be a reference change - attempting to update reference [rageshake.ts:74:27](webpack:///src/rageshake/rageshake.ts)
M_FORBIDDEN: MatrixError: [403] User @michael_test123:matrix.org not allowed to view events in room !fcxEbolLGVYuvOYLFz:matrix.org at token StreamToken(room_key=RoomStreamToken(topological=None, stream=4319768730, instance_map=immutabledict({})), presence_key=757284974, typing_key=17935268, receipt_key=2360272602, account_data_key=2467608598, push_rules_key=4593420, to_device_key=1046233990, device_list_key=8426187070, groups_key=0, un_partial_stated_rooms_key=172965) (https://matrix-client.matrix.org/_matrix/client/v3/rooms/!fcxEbolLGVYuvOYLFz%3Amatrix.org/members?not_membership=leave&at=s4319768730_757284974_17935268_2360272602_2467608598_4593420_1046233990_8426187070_0_172965)
    HTTPError errors.ts:34
    MatrixError errors.ts:63
    parseErrorResponse utils.ts:83
    requestOtherUrl fetch.ts:294

Copy link
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

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

Looks good code-wise. Unfortunately, the feature seems to have its flaws. @daniellekirkwood how do you think we should proceed here? Should we create issues for the things I found in the comments before and merge it as it is?

@@ -65,7 +68,7 @@ export function splitRoomsByMembership(rooms: Room[]): MembershipSplit {
export function getEffectiveMembership(membership: string): EffectiveMembership {
if (membership === "invite") {
return EffectiveMembership.Invite;
} else if (membership === "join") {
} else if (membership === "join" || (SettingsStore.getValue("feature_ask_to_join") && membership === "knock")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment below can be removed now 🥳

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, removed

import { createTestClient, mkRoomMember, stubClient } from "../test-utils";

describe("isKnockDenied", () => {
// const userId = MatrixClientPeg.get()!.getSafeUserId() //TODO: MA
Copy link
Contributor

Choose a reason for hiding this comment

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

There is still a TODO comment here. Hard-coding any matrix ID should be okay here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the point, deleted

@maheichyk
Copy link
Contributor Author

Tried to remove unknown room from im.vector.fake.recent: !fcxEbolLGVYuvOYLFz:matrix.org

This happens in Element for invite -> reject -> forget flow when room is sticky: user rejects the room he is invited into, then selects (clicks) on this room in archive (so room is sticky) and clicks on forget in the room options menu, the same errors. In the case of knock the room is sticky and the same problem just appears when we click on forget. Would be good to resolve this as separate issue.

@weeman1337
Copy link
Contributor

Tried to remove unknown room from im.vector.fake.recent: !fcxEbolLGVYuvOYLFz:matrix.org

This happens in Element for invite -> reject -> forget flow when room is sticky: user rejects the room he is invited into, then selects (clicks) on this room in archive (so room is sticky) and clicks on forget in the room options menu, the same errors. In the case of knock the room is sticky and the same problem just appears when we click on forget. Would be good to resolve this as separate issue.

👍 Okay. Can you please create one and add it to the epic?

@maheichyk
Copy link
Contributor Author

because there is some uncertainty how to implement this correctly and would be nice to improve it in separate PR.

What about removing the room from the client if it is discarded from the ui?

If this goes to a separate issue can you please create one and link it to the epic?

When room is forgotten (including denied knock) it should be deleted from the client already (this is how it already done for normal room forget) but it doesn't work for denied because of the issue before.

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
@maheichyk
Copy link
Contributor Author

👍 Okay. Can you please create one and add it to the epic?

I have created an issue: element-hq/element-web#26195

@maheichyk
Copy link
Contributor Author

Another issue is that the room does sometimes not appear in the list:

I tried on PR deployment and cannot reproduce it unfortunately, would be nice to have an issue with steps to reproduce, but the root cause could be not directly related to the changes in this PR.

@daniellekirkwood
Copy link

Thank you for creating a new issue to track the bugs found here!

At the moment denied knocks will disappear after some time if Element is reloaded several times, but this is probably okay for initial implementation (@daniellekirkwood please correct me if I am wrong here), because there is some uncertainty how to implement this correctly and would be nice to improve it in separate PR.

I think this is acceptable for now. If the user chooses to do nothing when they have been rejected 🤷 that feels like an enhancement we can handle better later.

Though, if the user chooses to "forget" the room it should be moved to their "historical" list. If this is not happening today, I would consider that a bug.

I'm not sure our process on PRs that have bugs, @weeman1337 ? I think that new issue created handles the bug cases introduced here, are we ok to accept this PR with the understanding that @maheichyk will work on those bugs, or do we need a PR for the bugs before accepting this one?

@weeman1337
Copy link
Contributor

I'm not sure our process on PRs that have bugs, @weeman1337 ? I think that new issue created handles the bug cases introduced here, are we ok to accept this PR with the understanding that @maheichyk will work on those bugs, or do we need a PR for the bugs before accepting this one?

Agree. @maheichyk already created issues.

@weeman1337 weeman1337 added this pull request to the merge queue Sep 19, 2023
Merged via the queue into matrix-org:develop with commit 86e86ba Sep 19, 2023
16 checks passed
@maheichyk maheichyk deleted the knock_list branch September 19, 2023 13:45
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 4, 2023
Changes in [1.11.47](https://github.com/vector-im/element-web/releases/tag/v1.11.47) (2023-10-24)
=================================================================================================

## 🦖 Deprecations
 * Deprecate customisations in favour of Module API ([\#25736](element-hq/element-web#25736)). Fixes #25733.

## ✨ Features
 * element-hq/element-x-ios/issues/1824 - Convert the apple-app-site-association file to a newer format… ([\#26307](element-hq/element-web#26307)). Contributed by @stefanceriu.
 * Iterate `io.element.late_event` decoration ([\#11760](matrix-org/matrix-react-sdk#11760)). Fixes #26384.
 * Render timeline separator for late event groups ([\#11739](matrix-org/matrix-react-sdk#11739)).
 * OIDC: revoke tokens on logout ([\#11718](matrix-org/matrix-react-sdk#11718)). Fixes #25394. Contributed by @kerryarchibald.
 * Show `io.element.late_event` in MessageTimestamp when known ([\#11733](matrix-org/matrix-react-sdk#11733)).
 * Show all labs flags if developerMode enabled ([\#11746](matrix-org/matrix-react-sdk#11746)). Fixes #24571 and #8498.
 * Use Compound tooltips on MessageTimestamp to improve UX of date time discovery ([\#11732](matrix-org/matrix-react-sdk#11732)). Fixes #25913.
 * Consolidate 4s passphrase input fields and use stable IDs ([\#11743](matrix-org/matrix-react-sdk#11743)). Fixes #26228.
 * Disable upgraderoom command without developer mode enabled ([\#11744](matrix-org/matrix-react-sdk#11744)). Fixes #17620.
 * Avoid rendering app download buttons if disabled in config ([\#11741](matrix-org/matrix-react-sdk#11741)). Fixes #26309.
 * OIDC: refresh tokens ([\#11699](matrix-org/matrix-react-sdk#11699)). Fixes #25839. Contributed by @kerryarchibald.
 * OIDC: register ([\#11727](matrix-org/matrix-react-sdk#11727)). Fixes #25393. Contributed by @kerryarchibald.
 * Use stable get_login_token and remove unstable MSC3882 support ([\#11001](matrix-org/matrix-react-sdk#11001)). Contributed by @hughns.

## 🐛 Bug Fixes
 * Set max size for Element logo in search warning ([\#11779](matrix-org/matrix-react-sdk#11779)). Fixes #26408.
 * Avoid error when DMing oneself ([\#11754](matrix-org/matrix-react-sdk#11754)). Fixes #7242.
 * Fix: Message shield alignment is not right. ([\#11703](matrix-org/matrix-react-sdk#11703)). Fixes #26142. Contributed by @manancodes.
 * fix logging full event ([\#11755](matrix-org/matrix-react-sdk#11755)). Fixes #26376.
 * OIDC: use delegated auth account URL from `OidcClientStore` ([\#11723](matrix-org/matrix-react-sdk#11723)). Fixes #26305. Contributed by @kerryarchibald.
 * Fix: Members list shield alignment is not right. ([\#11700](matrix-org/matrix-react-sdk#11700)). Fixes #26261. Contributed by @manancodes.
 * Fix: <detail> HTML elements clickable area too wide. ([\#11666](matrix-org/matrix-react-sdk#11666)). Fixes #25454. Contributed by @manancodes.
 * Fix untranslated headings in the devtools dialog ([\#11734](matrix-org/matrix-react-sdk#11734)).
 * Fixes invite dialog alignment and pill color contrast ([\#11722](matrix-org/matrix-react-sdk#11722)). Contributed by @gabrc52.
 * Prevent select element in General settings overflowing in a room with very long room-id ([\#11597](matrix-org/matrix-react-sdk#11597)). Contributed by @ABHIXIT2.
 * Fix: Clicking on members pile does nothing. ([\#11657](matrix-org/matrix-react-sdk#11657)). Fixes #26164. Contributed by @manancodes.
 * Fix: Wierd shadow below room avatar in dark mode. ([\#11678](matrix-org/matrix-react-sdk#11678)). Fixes #26153. Contributed by @manancodes.
 * Fix start_sso / start_cas URLs failing to redirect to a authentication prompt ([\#11681](matrix-org/matrix-react-sdk#11681)). Contributed by @Half-Shot.

Changes in [1.11.46](https://github.com/vector-im/element-web/releases/tag/v1.11.46) (2023-10-10)
=================================================================================================

## ✨ Features
 * Use .well-known to discover a default rendezvous server for use with Sign in with QR ([\#11655](matrix-org/matrix-react-sdk#11655)). Contributed by @hughns.
 * Message layout will update according to the selected style  ([\#10170](matrix-org/matrix-react-sdk#10170)). Fixes #21782. Contributed by @manancodes.
 * Implement MSC4039: Add an MSC for a new Widget API action to upload files into the media repository ([\#11311](matrix-org/matrix-react-sdk#11311)). Contributed by @dhenneke.
 * Render space pills with square corners to match new avatar ([\#11632](matrix-org/matrix-react-sdk#11632)). Fixes #26056.
 * Linkify room topic ([\#11631](matrix-org/matrix-react-sdk#11631)). Fixes #26185.
 * Show knock rooms in the list ([\#11573](matrix-org/matrix-react-sdk#11573)). Contributed by @maheichyk.

## 🐛 Bug Fixes
 * Bump matrix-web-i18n dependency to 3.1.3 ([\#26287](element-hq/element-web#26287))
 * Fix: Avatar shrinks with long names ([\#11698](matrix-org/matrix-react-sdk#11698)). Fixes #26252. Contributed by @manancodes.
 * Update custom translations to support nested fields in structured JSON ([\#11685](matrix-org/matrix-react-sdk#11685)).
 * Fix: Edited message remove button is hard to reach. ([\#11674](matrix-org/matrix-react-sdk#11674)). Fixes #24917. Contributed by @manancodes.
 * Fix: Theme selector radio button not aligned in center with the text ([\#11676](matrix-org/matrix-react-sdk#11676)). Fixes #25460. Contributed by @manancodes.
 * Fix: Unread notification dot aligned ([\#11658](matrix-org/matrix-react-sdk#11658)). Fixes #25285. Contributed by @manancodes.
 * Fix: sync intentional mentions push rules with legacy rules ([\#11667](matrix-org/matrix-react-sdk#11667)). Fixes #26227. Contributed by @kerryarchibald.
 * Revert "Fix regression around FacePile with overflow (#11527)" ([\#11634](matrix-org/matrix-react-sdk#11634)). Fixes #26209.
 * Fix: Alignment Fixed ([\#11648](matrix-org/matrix-react-sdk#11648)). Fixes #26169. Contributed by @manancodes.
 * Fix: onFinished added which closes the menu ([\#11647](matrix-org/matrix-react-sdk#11647)). Fixes #25556. Contributed by @manancodes.
 * Don't start key backups when opening settings ([\#11640](matrix-org/matrix-react-sdk#11640)).
 * Fix add to space avatar text centering ([\#11643](matrix-org/matrix-react-sdk#11643)). Fixes #26154.
 * fix avatar styling in lightbox ([\#11641](matrix-org/matrix-react-sdk#11641)). Fixes #26196.
estellecomment added a commit to tchapgouv/tchap-web-v4 that referenced this pull request Nov 29, 2023
…ixed yet)

* Use .well-known to discover a default rendezvous server for use with Sign in with QR ([\#11655](matrix-org/matrix-react-sdk#11655)). Contributed by @hughns.
* Message layout will update according to the selected style  ([\#10170](matrix-org/matrix-react-sdk#10170)). Fixes #21782. Contributed by @manancodes.
* Implement MSC4039: Add an MSC for a new Widget API action to upload files into the media repository ([\#11311](matrix-org/matrix-react-sdk#11311)). Contributed by @dhenneke.
* Render space pills with square corners to match new avatar ([\#11632](matrix-org/matrix-react-sdk#11632)). Fixes #26056.
* Linkify room topic ([\#11631](matrix-org/matrix-react-sdk#11631)). Fixes #26185.
* Show knock rooms in the list ([\#11573](matrix-org/matrix-react-sdk#11573)). Contributed by @maheichyk.
* Bump matrix-web-i18n dependency to 3.1.3 ([\#26287](element-hq/element-web#26287))
* Fix: Avatar shrinks with long names ([\#11698](matrix-org/matrix-react-sdk#11698)). Fixes #26252. Contributed by @manancodes.
* Update custom translations to support nested fields in structured JSON ([\#11685](matrix-org/matrix-react-sdk#11685)).
* Fix: Edited message remove button is hard to reach. ([\#11674](matrix-org/matrix-react-sdk#11674)). Fixes #24917. Contributed by @manancodes.
* Fix: Theme selector radio button not aligned in center with the text ([\#11676](matrix-org/matrix-react-sdk#11676)). Fixes #25460. Contributed by @manancodes.
* Fix: Unread notification dot aligned ([\#11658](matrix-org/matrix-react-sdk#11658)). Fixes #25285. Contributed by @manancodes.
* Fix: sync intentional mentions push rules with legacy rules ([\#11667](matrix-org/matrix-react-sdk#11667)). Fixes #26227. Contributed by @kerryarchibald.
* Revert "Fix regression around FacePile with overflow (#11527)" ([\#11634](matrix-org/matrix-react-sdk#11634)). Fixes #26209.
* Fix: Alignment Fixed ([\#11648](matrix-org/matrix-react-sdk#11648)). Fixes #26169. Contributed by @manancodes.
* Fix: onFinished added which closes the menu ([\#11647](matrix-org/matrix-react-sdk#11647)). Fixes #25556. Contributed by @manancodes.
* Don't start key backups when opening settings ([\#11640](matrix-org/matrix-react-sdk#11640)).
* Fix add to space avatar text centering ([\#11643](matrix-org/matrix-react-sdk#11643)). Fixes #26154.
* fix avatar styling in lightbox ([\#11641](matrix-org/matrix-react-sdk#11641)). Fixes #26196.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants