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

Commit

Permalink
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
Browse files Browse the repository at this point in the history
… t3chguy/localazy-common-4

# Conflicts:
#	src/components/views/beacon/RoomLiveShareWarning.tsx
#	src/components/views/dialogs/SetEmailDialog.tsx
  • Loading branch information
t3chguy committed Aug 22, 2023
2 parents 3fd4778 + df4a221 commit 9530baf
Show file tree
Hide file tree
Showing 383 changed files with 4,734 additions and 4,761 deletions.
10 changes: 2 additions & 8 deletions __mocks__/languages.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"en": {
"fileName": "en_EN.json",
"label": "English"
},
"en-us": {
"fileName": "en_US.json",
"label": "English (US)"
}
"en": "en_EN.json",
"en-us": "en_US.json"
}
4 changes: 2 additions & 2 deletions cypress/e2e/editing/editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe("Editing", () => {
// Assert that the date separator is rendered at the top
cy.get("li:nth-child(1) .mx_DateSeparator").within(() => {
cy.get("h2").within(() => {
cy.findByText("Today");
cy.findByText("today").should("have.css", "text-transform", "capitalize");
});
});

Expand Down Expand Up @@ -184,7 +184,7 @@ describe("Editing", () => {
// Assert that the date is rendered
cy.get("li:nth-child(1) .mx_DateSeparator").within(() => {
cy.get("h2").within(() => {
cy.findByText("Today");
cy.findByText("today").should("have.css", "text-transform", "capitalize");
});
});

Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/settings/general-user-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ describe("General user settings tab", () => {
cy.findByRole("button", { name: "Language Dropdown" }).click();

// Assert that the default option is rendered and highlighted
cy.findByRole("option", { name: /Bahasa Indonesia/ })
cy.findByRole("option", { name: /Albanian/ })
.should("be.visible")
.should("have.class", "mx_Dropdown_option_highlight");

cy.findByRole("option", { name: /Deutsch/ }).should("be.visible");

// Click again to close the dropdown
cy.findByRole("button", { name: "Language Dropdown" }).click();

Expand Down
7 changes: 6 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const config: Config = {
"RecorderWorklet": "<rootDir>/__mocks__/empty.js",
},
transformIgnorePatterns: ["/node_modules/(?!matrix-js-sdk).+$"],
collectCoverageFrom: ["<rootDir>/src/**/*.{js,ts,tsx}"],
collectCoverageFrom: [
"<rootDir>/src/**/*.{js,ts,tsx}",
// getSessionLock is piped into a different JS context via stringification, and the coverage functionality is
// not available in that contest. So, turn off coverage instrumentation for it.
"!<rootDir>/src/utils/SessionLock.ts",
],
coverageReporters: ["text-summary", "lcov"],
testResultsProcessor: "@casualbot/jest-sonar-reporter",
};
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
"dependencies": {
"@babel/runtime": "^7.12.5",
"@matrix-org/analytics-events": "^0.6.0",
"@matrix-org/emojibase-bindings": "^1.1.2",
"@matrix-org/matrix-wysiwyg": "^2.4.1",
"@matrix-org/react-sdk-module-api": "^2.0.0",
"@matrix-org/react-sdk-module-api": "^2.1.0",
"@matrix-org/spec": "^1.7.0",
"@sentry/browser": "^7.0.0",
"@sentry/tracing": "^7.0.0",
Expand All @@ -76,8 +77,6 @@
"counterpart": "^0.18.6",
"diff-dom": "^4.2.2",
"diff-match-patch": "^1.0.5",
"emojibase": "15.0.0",
"emojibase-data": "15.0.0",
"emojibase-regex": "15.0.0",
"escape-html": "^1.0.3",
"file-saver": "^2.0.5",
Expand Down Expand Up @@ -122,6 +121,7 @@
"sanitize-html": "2.11.0",
"tar-js": "^0.3.0",
"ua-parser-js": "^1.0.2",
"uuid": "^9.0.0",
"what-input": "^5.2.10",
"zxcvbn": "^4.4.2"
},
Expand Down
1 change: 1 addition & 0 deletions res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
@import "./views/elements/_InteractiveTooltip.pcss";
@import "./views/elements/_InviteReason.pcss";
@import "./views/elements/_LabelledCheckbox.pcss";
@import "./views/elements/_LanguageDropdown.pcss";
@import "./views/elements/_MiniAvatarUploader.pcss";
@import "./views/elements/_Pill.pcss";
@import "./views/elements/_PowerSelector.pcss";
Expand Down
21 changes: 21 additions & 0 deletions res/css/views/elements/_LanguageDropdown.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_LanguageDropdown {
.mx_Dropdown_option > div {
text-transform: capitalize;
}
}
1 change: 1 addition & 0 deletions res/css/views/messages/_DateSeparator.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ limitations under the License.
font-size: inherit;
font-weight: inherit;
color: inherit;
text-transform: capitalize;
}

.mx_DateSeparator_jumpToDateMenu {
Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ sonar.exclusions=__mocks__,docs
sonar.cpd.exclusions=src/i18n/strings/*.json
sonar.typescript.tsconfigPath=./tsconfig.json
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.coverage.exclusions=test/**/*,cypress/**/*,src/components/views/dialogs/devtools/**/*
# instrumentation is disabled on SessionLock
sonar.coverage.exclusions=test/**/*,cypress/**/*,src/components/views/dialogs/devtools/**/*,src/utils/SessionLock.ts
sonar.testExecutionReportPaths=coverage/jest-sonar-report.xml
43 changes: 31 additions & 12 deletions src/@types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,41 @@ export type Writeable<T> = { -readonly [P in keyof T]: T[P] };

export type ComponentClass = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;

// Utility type for string dot notation for accessing nested object properties
// Based on https://stackoverflow.com/a/58436959
type Join<K, P> = K extends string | number
/**
* Utility type for string dot notation for accessing nested object properties.
* Based on https://stackoverflow.com/a/58436959
* @example
* {
* "a": {
* "b": {
* "c": "value"
* },
* "d": "foobar"
* }
* }
* will yield a type of `"a.b.c" | "a.d"` with Separator="."
* @typeParam Target the target type to generate leaf keys for
* @typeParam Separator the separator to use between key segments when accessing nested objects
* @typeParam LeafType the type which leaves of this object extend, used to determine when to stop recursion
* @typeParam MaxDepth the maximum depth to recurse to
* @returns a union type representing all dot (Separator) string notation keys which can access a Leaf (of LeafType)
*/
export type Leaves<Target, Separator extends string = ".", LeafType = string, MaxDepth extends number = 3> = [
MaxDepth,
] extends [never]
? never
: Target extends LeafType
? ""
: {
[K in keyof Target]-?: Join<K, Leaves<Target[K], Separator, LeafType, Prev[MaxDepth]>, Separator>;
}[keyof Target];
type Prev = [never, 0, 1, 2, 3, ...0[]];
type Join<K, P, S extends string = "."> = K extends string | number
? P extends string | number
? `${K}${"" extends P ? "" : "."}${P}`
? `${K}${"" extends P ? "" : S}${P}`
: never
: never;

type Prev = [never, 0, 1, 2, 3, ...0[]];

export type Leaves<T, D extends number = 3> = [D] extends [never]
? never
: T extends object
? { [K in keyof T]-?: Join<K, Leaves<T[K], Prev[D]>> }[keyof T]
: "";

export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
Expand Down
2 changes: 1 addition & 1 deletion src/AsyncWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class AsyncWrapper extends React.Component<IProps, IState> {
return <Component {...this.props} />;
} else if (this.state.error) {
return (
<BaseDialog onFinished={this.props.onFinished} title={_t("Error")}>
<BaseDialog onFinished={this.props.onFinished} title={_t("common|error")}>
{_t("Unable to load! Check your network connectivity and try again.")}
<DialogButtons
primaryButton={_t("action|dismiss")}
Expand Down
Loading

0 comments on commit 9530baf

Please sign in to comment.