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

WIP: Implement Knocking #9093

Closed
wants to merge 8 commits into from
Closed

Conversation

ankur12-1610
Copy link
Contributor

@ankur12-1610 ankur12-1610 commented Jul 23, 2022

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)

Demo for Creating Room:

Knocking-demo.mp4

Demo for Room Settings:

demo-room-settings.mp4

Related PR: vector-im/#22926


This PR currently has none of the required changelog labels.

A reviewer can add one of: T-Deprecation, T-Enhancement, T-Defect, T-Task to indicate what type of change this is, or add Type: [enhancement/defect/task] to the description and I'll add them for you.

Copy link
Contributor

@SimonBrandner SimonBrandner left a comment

Choose a reason for hiding this comment

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

Looking great! Just a few nits mainly regarding the desings

src/i18n/strings/en_EN.json Outdated Show resolved Hide resolved
src/components/views/elements/JoinRuleDropdown.tsx Outdated Show resolved Hide resolved
src/components/views/dialogs/CreateRoomDialog.tsx Outdated Show resolved Hide resolved
src/components/views/dialogs/CreateRoomDialog.tsx Outdated Show resolved Hide resolved
src/components/views/dialogs/CreateRoomDialog.tsx Outdated Show resolved Hide resolved
@ankur12-1610
Copy link
Contributor Author

Looking great! Just a few nits mainly regarding the desings

@SimonBrandner I've resolved nits and added one more commit, also I;ve updated the video can you please look into it?

Copy link
Contributor

@SimonBrandner SimonBrandner left a comment

Choose a reason for hiding this comment

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

Looking great

Copy link
Contributor

@SimonBrandner SimonBrandner left a comment

Choose a reason for hiding this comment

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

Looking great!

value: JoinRule.Knock,
label: _t("Ask to join"),
description: _t("Requires users to be granted access in order to join"),
checked: joinRule === JoinRule.Knock && knockingEnabled === true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might want to show this even if knockingEnabled === false to avoid lying to the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This variable is to check whether knocking option is enabled in the labs flag or not, if not enabled will it be right to show this option?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, though even if it is disabled, the room's join rule could be JoinRule.Knock - we should be smarter and show the user what the actual join rule is no matter what but we shouldn't allow the user to set the join rule to JoinRule.Knock if knockingEnabled === false

Copy link
Member

Choose a reason for hiding this comment

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

it's sort of expected that the labs flag will be moderately short-lived, so would be okay with it just being wrong when people don't have the labs flag enabled.

@@ -49,13 +50,20 @@ interface IProps {
const JoinRuleSettings = ({ room, promptUpgrade, aliasWarning, onError, beforeChange, closeSettingsFn }: IProps) => {
const cli = room.client;

const roomSupportsKnocking = doesRoomVersionSupport(room.getVersion(), PreferredRoomVersions.KnockingRooms);
const preferredKnockingVersion = !roomSupportsKnocking && promptUpgrade
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah going to use it to check the room version supports knocking or not

Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

generally this seems to be going in the correct direction!

For this PR, I think we'll just need the cypress tests and room version check mentioned elsewhere. Then we can get it landed and in front of users while we work on the rest of the features.

value: JoinRule.Knock,
label: _t("Ask to join"),
description: _t("Requires users to be granted access in order to join"),
checked: joinRule === JoinRule.Knock && knockingEnabled === true,
Copy link
Member

Choose a reason for hiding this comment

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

it's sort of expected that the labs flag will be moderately short-lived, so would be okay with it just being wrong when people don't have the labs flag enabled.

@ankur12-1610
Copy link
Contributor Author

ankur12-1610 commented Aug 8, 2022

@turt2live I've made the recent push and I've also uploaded the video of the updated code which conditionally renders the room settings option according to labs flag, can you verify it? 😅

Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

looks to be in the right direction :)

please try to avoid force-pushing (rebasing) after review has already been given - it makes things a bit harder to review. We don't mind merge commits when updating the branch because we'll squash them all down to 1 when we merge the PR.

@ankur12-1610
Copy link
Contributor Author

looks to be in the right direction :)

please try to avoid force-pushing (rebasing) after review has already been given - it makes things a bit harder to review. We don't mind merge commits when updating the branch because we'll squash them all down to 1 when we merge the PR.

Agh! sorry for it I just do it in order avoid one extra merge commit everytime I update my branch 😅 I'll keep it in mind

Comment on lines +48 to +49
cy.get('[label="Name"]').type(name);
cy.get('[label="Topic (optional)"]').type(topic);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we tend to use aria-label for selecting usually but it probably doesn't matter much

cy.get('[label="Topic (optional)"]').type(topic);
cy.get(".mx_JoinRuleDropdown").click();
cy.get(".mx_JoinRuleDropdown_knock").click();
cy.startMeasuring("from-submit-to-room");
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what is the purpose of this? I am not sure if it makes sense to have a performance test specific to knocking?

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 is the purpose of this? I am not sure if it makes sense to have a performance test specific to knocking?

I thought since we are using it in createRoom.spec.ts it has some importance or something like that


// Change room settings
cy.openRoomSettings("Security & Privacy");
cy.get(".mx_StyledRadioButton_content").contains("Ask to join").click();
Copy link
Contributor

Choose a reason for hiding this comment

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

/me might be confused - are you setting the join rule to the same thing again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/me might be confused - are you setting the join rule to the same thing again?

Agh! thanks for it actually it was a bug in the JoinRuleSettings itself there wasn't an event message for join rule knock, I solved it now there shouldn't be a problem ;)

Comment on lines 61 to 65
//Check if the room settings are visible if labs flag is disabled
cy.openUserSettings("Labs").within(() => {
//disables labs flag feature
cy.get("[aria-label='Knocking']").click();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

If you could add disableLabsFeature analogous to enableLabsFeature, it would be absolutely awesome!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you could add disableLabsFeature analogous to enableLabsFeature, it would be absolutely awesome!

I tried it but Idk why it isn't working could you please verify my latest pull 😅

@t3chguy
Copy link
Member

t3chguy commented Aug 4, 2023

This has been superseded by PRs from Nordeck

@t3chguy t3chguy closed this Aug 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants