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

Commit

Permalink
Resolved linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur12-1610 committed Aug 16, 2022
1 parent 104d560 commit 2651aab
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cypress/e2e/knocking/knocking.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
/// <reference types="cypress" />

import { SynapseInstance } from "../../plugins/synapsedocker";
import { MatrixClient } from "../../global";
import Chainable = Cypress.Chainable;

function openCreateRoomDialog(): Chainable<JQuery<HTMLElement>> {
Expand Down Expand Up @@ -54,19 +53,24 @@ describe("Knocking", () => {
cy.get(".mx_Dialog_primary").click();
});

// Change room settings
// The room settings initially are set to Ask to join
cy.openRoomSettings("Security & Privacy");
cy.get(".mx_StyledRadioButton_content").contains("Ask to join").click();
cy.closeDialog();

//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();
// cy.disableLabsFeature("feature_knocking");
});
cy.closeDialog();
//the default joinRule is set to Private (invite only)

//the default joinRule is set to Private (invite only) when the labs flag is disabled
cy.openRoomSettings("Security & Privacy");
cy.closeDialog();

// Click the expand link button to get more detailed view
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();

cy.stopMeasuring("from-submit-to-room");
cy.get(".mx_RoomHeader_nametext").contains(name);
Expand Down
8 changes: 8 additions & 0 deletions cypress/support/labs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ declare global {
* @param feature labsFeature to enable (e.g. "feature_spotlight")
*/
enableLabsFeature(feature: string): Chainable<null>;
disableLabsFeature(feature: string): Chainable<null>;
}
}
}
Expand All @@ -38,5 +39,12 @@ Cypress.Commands.add("enableLabsFeature", (feature: string): Chainable<null> =>
}).then(() => null);
});

Cypress.Commands.add("disableLabsFeature", (feature: string): Chainable<null> => {
return cy.window({ log: false }).then(win => {
win.localStorage.removeItem(`mx_labs_feature_${feature}`);
win.localStorage.setItem(`mx_labs_feature_${feature}`, "false");
}).then(() => null);
});

// Needed to make this file a module
export { };
4 changes: 4 additions & 0 deletions src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ function textForJoinRulesEvent(ev: MatrixEvent, allowJSX: boolean): () => Render
return () => _t('%(senderDisplayName)s made the room invite only.', {
senderDisplayName,
});
case JoinRule.Knock:
return () => _t('%(senderDisplayName)s made the room knock only.', {
senderDisplayName,
});
case JoinRule.Restricted:
if (allowJSX) {
return () => <span>
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/dialogs/CreateRoomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
opts.joinRule = JoinRule.Restricted;
}

if (this.state.joinRule === JoinRule.Knock) {
opts.joinRule = JoinRule.Knock;
}
return opts;
}

Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@
"%(senderDisplayName)s upgraded this room.": "%(senderDisplayName)s upgraded this room.",
"%(senderDisplayName)s made the room public to whoever knows the link.": "%(senderDisplayName)s made the room public to whoever knows the link.",
"%(senderDisplayName)s made the room invite only.": "%(senderDisplayName)s made the room invite only.",
"%(senderDisplayName)s made the room knock only.": "%(senderDisplayName)s made the room knock only.",
"%(senderDisplayName)s changed who can join this room. <a>View settings</a>.": "%(senderDisplayName)s changed who can join this room. <a>View settings</a>.",
"%(senderDisplayName)s changed who can join this room.": "%(senderDisplayName)s changed who can join this room.",
"%(senderDisplayName)s changed the join rule to %(rule)s": "%(senderDisplayName)s changed the join rule to %(rule)s",
Expand Down

0 comments on commit 2651aab

Please sign in to comment.