diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml index 248fb50c9e..aa243d2962 100644 --- a/.github/workflows/netlify.yaml +++ b/.github/workflows/netlify.yaml @@ -41,7 +41,7 @@ jobs: - name: ☁️ Deploy to Netlify id: netlify - uses: nwtgck/actions-netlify@5da65c9f74c7961c5501a3ba329b8d0912f39c03 # v2.0 + uses: nwtgck/actions-netlify@7a92f00dde8c92a5a9e8385ec2919775f7647352 # v2.1 with: publish-dir: webapp deploy-message: "Deploy from GitHub Actions" diff --git a/package.json b/package.json index 6d9e038399..68969bb87e 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "emojibase-regex": "15.0.0", "escape-html": "^1.0.3", "file-saver": "^2.0.5", - "filesize": "10.0.7", + "filesize": "10.0.12", "focus-visible": "^5.2.0", "gfm.css": "^1.1.2", "glob-to-regexp": "^0.4.1", @@ -106,7 +106,7 @@ "opus-recorder": "^8.0.3", "pako": "^2.0.3", "png-chunks-extract": "^1.0.0", - "posthog-js": "1.73.1", + "posthog-js": "1.77.2", "proposal-temporal": "^0.9.0", "qrcode": "1.5.3", "re-resizable": "^6.9.0", @@ -190,14 +190,14 @@ "cypress-multi-reporters": "^1.6.1", "cypress-real-events": "^1.7.1", "cypress-terminal-report": "^5.3.2", - "eslint": "8.45.0", + "eslint": "8.48.0", "eslint-config-google": "^0.14.0", "eslint-config-prettier": "^9.0.0", - "eslint-plugin-deprecate": "^0.7.0", + "eslint-plugin-deprecate": "0.7.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jest": "^27.2.1", "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-matrix-org": "1.2.0", + "eslint-plugin-matrix-org": "1.2.1", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-unicorn": "^48.0.0", diff --git a/res/css/compound/_SuccessDialog.pcss b/res/css/compound/_SuccessDialog.pcss index 61f98a97df..9085cedc11 100644 --- a/res/css/compound/_SuccessDialog.pcss +++ b/res/css/compound/_SuccessDialog.pcss @@ -18,7 +18,7 @@ limitations under the License. text-align: center; .mx_Icon { - mask-border: $spacing-16; + margin-bottom: $spacing-16; } .mx_Dialog_header { diff --git a/src/components/views/dialogs/UploadFailureDialog.tsx b/src/components/views/dialogs/UploadFailureDialog.tsx index 6d478605c7..7a677acb62 100644 --- a/src/components/views/dialogs/UploadFailureDialog.tsx +++ b/src/components/views/dialogs/UploadFailureDialog.tsx @@ -51,7 +51,7 @@ export default class UploadFailureDialog extends React.Component { message = _t( "This file is too large to upload. The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.", { - limit: fileSize(this.props.contentMessages.getUploadLimit()), + limit: fileSize(this.props.contentMessages.getUploadLimit()!), sizeOfThisFile: fileSize(this.props.badFiles[0].size), }, { @@ -70,7 +70,7 @@ export default class UploadFailureDialog extends React.Component { message = _t( "These files are too large to upload. The file size limit is %(limit)s.", { - limit: fileSize(this.props.contentMessages.getUploadLimit()), + limit: fileSize(this.props.contentMessages.getUploadLimit()!), }, { b: (sub) => {sub}, @@ -88,7 +88,7 @@ export default class UploadFailureDialog extends React.Component { message = _t( "Some files are too large to be uploaded. The file size limit is %(limit)s.", { - limit: fileSize(this.props.contentMessages.getUploadLimit()), + limit: fileSize(this.props.contentMessages.getUploadLimit()!), }, { b: (sub) => {sub}, diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index 3d34fe7553..8423a54ce4 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -15,20 +15,29 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { filesize } from "filesize"; +import { + filesize, + FileSizeOptionsArray, + FileSizeOptionsBase, + FileSizeOptionsExponent, + FileSizeOptionsObject, + FileSizeOptionsString, + FileSizeReturnArray, + FileSizeReturnObject, +} from "filesize"; import { IMediaEventContent } from "../customisations/models/IMediaEventContent"; import { _t } from "../languageHandler"; /** - * Extracts a human readable label for the file attachment to use as + * Extracts a human-readable label for the file attachment to use as * link text. * * @param {IMediaEventContent} content The "content" key of the matrix event. * @param {string} fallbackText The fallback text * @param {boolean} withSize Whether to include size information. Default true. * @param {boolean} shortened Ensure the extension of the file name is visible. Default false. - * @return {string} the human readable link text for the attachment. + * @return {string} the human-readable link text for the attachment. */ export function presentableTextForFile( content: IMediaEventContent, @@ -74,10 +83,17 @@ export function presentableTextForFile( return text; } +type FileSizeOptions = + | FileSizeOptionsString + | FileSizeOptionsBase + | FileSizeOptionsArray + | FileSizeOptionsExponent + | FileSizeOptionsObject; + /** * wrapper function to set default values for filesize function * - * @param size size of file + * @param byteCount size of file * @param options options to customize the response type or size type conversion e.g. 12kB, 12KB * @returns {string | number | any[] | { * value: any; @@ -85,10 +101,15 @@ export function presentableTextForFile( * exponent: number; * unit: string;}} formatted file size with unit e.g. 12kB, 12KB */ +export function fileSize(byteCount: number, options: FileSizeOptionsString | FileSizeOptionsBase): string; +export function fileSize(byteCount: number, options: FileSizeOptionsArray): FileSizeReturnArray; +export function fileSize(byteCount: number, options: FileSizeOptionsExponent): number; +export function fileSize(byteCount: number, options: FileSizeOptionsObject): FileSizeReturnObject; +export function fileSize(byteCount: number): string; export function fileSize( - size: Parameters[0], - options?: Parameters[1], -): ReturnType { - const defaultOption: Parameters[1] = { base: 2, standard: "jedec", ...options }; - return filesize(size, defaultOption); + byteCount: number, + options?: FileSizeOptions, +): string | number | FileSizeReturnArray | FileSizeReturnObject { + const defaultOption: FileSizeOptions = { base: 2, standard: "jedec", ...options }; + return filesize(byteCount, defaultOption); } diff --git a/yarn.lock b/yarn.lock index ec5138da27..24bf7ca71d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1449,10 +1449,15 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== -"@eslint/eslintrc@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" - integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== +"@eslint-community/regexpp@^4.6.1": + version "4.8.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" + integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== + +"@eslint/eslintrc@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" + integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -1464,10 +1469,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.44.0": - version "8.44.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" - integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== +"@eslint/js@8.48.0": + version "8.48.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.48.0.tgz#642633964e217905436033a2bd08bf322849b7fb" + integrity sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw== "@floating-ui/core@^1.4.1": version "1.4.1" @@ -3187,7 +3192,7 @@ ajv-keywords@^3.5.2: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: +ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4984,7 +4989,7 @@ eslint-module-utils@^2.7.4: dependencies: debug "^3.2.7" -eslint-plugin-deprecate@^0.7.0: +eslint-plugin-deprecate@0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/eslint-plugin-deprecate/-/eslint-plugin-deprecate-0.7.0.tgz#04805d2f2884800c580d59933b9c895f31b02437" integrity sha512-MylhCqoH/SJ2MwzVgX0we6oE+lKPVwhOu9hAJ98vMCmbz3FNwqJ8XipdI23bCF7NHxUbhd6mdxFjywKE52pt7A== @@ -5039,10 +5044,10 @@ eslint-plugin-jsx-a11y@^6.5.1: object.fromentries "^2.0.6" semver "^6.3.0" -eslint-plugin-matrix-org@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-1.2.0.tgz#84b78969c93e6d3d593fe8bf25ee67ec4dcd2883" - integrity sha512-Wp5CeLnyEwGBn8ZfVbSuO2y0Fs51IWonPJ1QRQTntaRxOkEQnnky3gOPwpfGJ8JB0CxYr1zXfeHh8LcYHW4wcg== +eslint-plugin-matrix-org@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-1.2.1.tgz#76d1505daa93fb99ba4156008b9b32f57682c9b1" + integrity sha512-A3cDjhG7RHwfCS8o3bOip8hSCsxtmgk2ahvqE5v/Ic2kPEZxixY6w8zLj7hFGsrRmPSEpLWqkVLt8uvQBapiQA== eslint-plugin-react-hooks@^4.3.0: version "4.6.0" @@ -5104,10 +5109,10 @@ eslint-scope@5.1.1, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" - integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -5122,27 +5127,32 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@8.45.0: - version "8.45.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.45.0.tgz#bab660f90d18e1364352c0a6b7c6db8edb458b78" - integrity sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw== +eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@8.48.0: + version "8.48.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.48.0.tgz#bf9998ba520063907ba7bfe4c480dc8be03c2155" + integrity sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.1.0" - "@eslint/js" "8.44.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.2" + "@eslint/js" "8.48.0" "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" + ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.2.0" - eslint-visitor-keys "^3.4.1" - espree "^9.6.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -5165,7 +5175,7 @@ eslint@8.45.0: strip-ansi "^6.0.1" text-table "^0.2.0" -espree@^9.6.0: +espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== @@ -5484,10 +5494,10 @@ file-saver@^2.0.5: resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.5.tgz#d61cfe2ce059f414d899e9dd6d4107ee25670c38" integrity sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA== -filesize@10.0.7: - version "10.0.7" - resolved "https://registry.yarnpkg.com/filesize/-/filesize-10.0.7.tgz#2237a816ee60a83fd0c3382ae70800e54eced3ad" - integrity sha512-iMRG7Qo9nayLoU3PNCiLizYtsy4W1ClrapeCwEgtiQelOAOuRJiw4QaLI+sSr8xr901dgHv+EYP2bCusGZgoiA== +filesize@10.0.12: + version "10.0.12" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-10.0.12.tgz#6eef217c08e9633cdbf438d9124e8f5f524ffa05" + integrity sha512-6RS9gDchbn+qWmtV2uSjo5vmKizgfCQeb5jKmqx8HyzA3MoLqqyQxN+QcjkGBJt7FjJ9qFce67Auyya5rRRbpw== fill-range@^7.0.1: version "7.0.1" @@ -8305,10 +8315,10 @@ postcss@^8.4.25: picocolors "^1.0.0" source-map-js "^1.0.2" -posthog-js@1.73.1: - version "1.73.1" - resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.73.1.tgz#8b994e595ab8e847bc9b55707c9cd0b22f655352" - integrity sha512-eN08SkMdOG14TbUWek/7it4nCwcclK4MklCemq4/JK+rdsVqCWJXnYG2EdUOMoLv8wZOZ0yKIdc0vLI/ctrT/w== +posthog-js@1.77.2: + version "1.77.2" + resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.77.2.tgz#c5ecb2dc0b0e732fe05f50920ec22a30e3db4916" + integrity sha512-I3l5GipPUFe6qd5/0Bgm8Ot4pF8ysWhNgeLWvk69myh58HREfXACgLSYMZBho6L9xC6OcFvQilpcH+Dj3Y2uIQ== dependencies: fflate "^0.4.1"