From 7e3c10dec676b0a560493071c5950c7e5df759b2 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 13 Nov 2023 15:39:45 +0100 Subject: [PATCH 01/15] Add icons for private and disabled boost in web UI (#27817) Co-authored-by: Claire --- .../mastodon/components/status_action_bar.jsx | 12 ++++++++++-- .../features/status/components/action_bar.jsx | 12 ++++++++++-- app/javascript/svg-icons/repeat_disabled.svg | 5 +++++ app/javascript/svg-icons/repeat_private.svg | 5 +++++ config/webpack/rules/material_icons.js | 2 +- 5 files changed, 31 insertions(+), 5 deletions(-) create mode 100755 app/javascript/svg-icons/repeat_disabled.svg create mode 100755 app/javascript/svg-icons/repeat_private.svg diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 2401747390..25eab91fe3 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -19,6 +19,8 @@ import { ReactComponent as StarIcon } from '@material-symbols/svg-600/outlined/s import { ReactComponent as StarBorderIcon } from '@material-symbols/svg-600/outlined/star.svg'; import { ReactComponent as VisibilityIcon } from '@material-symbols/svg-600/outlined/visibility.svg'; +import { ReactComponent as RepeatDisabledIcon } from 'mastodon/../svg-icons/repeat_disabled.svg'; +import { ReactComponent as RepeatPrivateIcon } from 'mastodon/../svg-icons/repeat_private.svg'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; import { WithRouterPropTypes } from 'mastodon/utils/react_router'; @@ -348,6 +350,7 @@ class StatusActionBar extends ImmutablePureComponent { let replyIcon; let replyIconComponent; let replyTitle; + if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; replyIconComponent = ReplyIcon; @@ -360,15 +363,20 @@ class StatusActionBar extends ImmutablePureComponent { const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private'; - let reblogTitle = ''; + let reblogTitle, reblogIconComponent; + if (status.get('reblogged')) { reblogTitle = intl.formatMessage(messages.cancel_reblog_private); + reblogIconComponent = publicStatus ? RepeatIcon : RepeatPrivateIcon; } else if (publicStatus) { reblogTitle = intl.formatMessage(messages.reblog); + reblogIconComponent = RepeatIcon; } else if (reblogPrivate) { reblogTitle = intl.formatMessage(messages.reblog_private); + reblogIconComponent = RepeatPrivateIcon; } else { reblogTitle = intl.formatMessage(messages.cannot_reblog); + reblogIconComponent = RepeatDisabledIcon; } const filterButton = this.props.onFilter && ( @@ -380,7 +388,7 @@ class StatusActionBar extends ImmutablePureComponent { return (
- + diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index eac0bab7e1..663bce7431 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -18,6 +18,8 @@ import { ReactComponent as ReplyAllIcon } from '@material-symbols/svg-600/outlin import { ReactComponent as StarIcon } from '@material-symbols/svg-600/outlined/star-fill.svg'; import { ReactComponent as StarBorderIcon } from '@material-symbols/svg-600/outlined/star.svg'; +import { ReactComponent as RepeatDisabledIcon } from 'mastodon/../svg-icons/repeat_disabled.svg'; +import { ReactComponent as RepeatPrivateIcon } from 'mastodon/../svg-icons/repeat_private.svg'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; import { WithRouterPropTypes } from 'mastodon/utils/react_router'; @@ -280,6 +282,7 @@ class ActionBar extends PureComponent { let replyIcon; let replyIconComponent; + if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; replyIconComponent = ReplyIcon; @@ -290,21 +293,26 @@ class ActionBar extends PureComponent { const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private'; - let reblogTitle; + let reblogTitle, reblogIconComponent; + if (status.get('reblogged')) { reblogTitle = intl.formatMessage(messages.cancel_reblog_private); + reblogIconComponent = publicStatus ? RepeatIcon : RepeatPrivateIcon; } else if (publicStatus) { reblogTitle = intl.formatMessage(messages.reblog); + reblogIconComponent = RepeatIcon; } else if (reblogPrivate) { reblogTitle = intl.formatMessage(messages.reblog_private); + reblogIconComponent = RepeatPrivateIcon; } else { reblogTitle = intl.formatMessage(messages.cannot_reblog); + reblogIconComponent = RepeatDisabledIcon; } return (
-
+
diff --git a/app/javascript/svg-icons/repeat_disabled.svg b/app/javascript/svg-icons/repeat_disabled.svg new file mode 100755 index 0000000000..3157f660e0 --- /dev/null +++ b/app/javascript/svg-icons/repeat_disabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/app/javascript/svg-icons/repeat_private.svg b/app/javascript/svg-icons/repeat_private.svg new file mode 100755 index 0000000000..a65be532ab --- /dev/null +++ b/app/javascript/svg-icons/repeat_private.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/config/webpack/rules/material_icons.js b/config/webpack/rules/material_icons.js index 7ac1072b0a..048e198ef2 100644 --- a/config/webpack/rules/material_icons.js +++ b/config/webpack/rules/material_icons.js @@ -1,6 +1,6 @@ module.exports = { test: /\.svg$/, - include: /node_modules\/@material-symbols/, + include: [/node_modules\/@material-symbols/, /svg-icons/], issuer: /\.[jt]sx?$/, use: [ { From a1b48460e4e22cb552b35776a5cc03961c619d9f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:40:10 +0100 Subject: [PATCH 02/15] Update DefinitelyTyped types (non-major) (#27830) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 178 +++++++++++++++++++++++++-------------------------- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/package.json b/package.json index 96bfb1571c..6f20b98bcf 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "@types/react-dom": "^18.2.4", "@types/react-helmet": "^6.1.6", "@types/react-immutable-proptypes": "^2.1.0", - "@types/react-motion": "^0.0.36", + "@types/react-motion": "^0.0.37", "@types/react-overlays": "^3.1.0", "@types/react-router": "^5.1.20", "@types/react-router-dom": "^5.3.3", diff --git a/yarn.lock b/yarn.lock index 891eb59fef..b05b2bfbce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2384,7 +2384,7 @@ __metadata: "@types/react-dom": "npm:^18.2.4" "@types/react-helmet": "npm:^6.1.6" "@types/react-immutable-proptypes": "npm:^2.1.0" - "@types/react-motion": "npm:^0.0.36" + "@types/react-motion": "npm:^0.0.37" "@types/react-overlays": "npm:^3.1.0" "@types/react-router": "npm:^5.1.20" "@types/react-router-dom": "npm:^5.3.3" @@ -3006,15 +3006,15 @@ __metadata: linkType: hard "@types/babel__core@npm:*, @types/babel__core@npm:^7.1.12, @types/babel__core@npm:^7.1.14, @types/babel__core@npm:^7.1.7, @types/babel__core@npm:^7.20.1": - version: 7.20.3 - resolution: "@types/babel__core@npm:7.20.3" + version: 7.20.4 + resolution: "@types/babel__core@npm:7.20.4" dependencies: "@babel/parser": "npm:^7.20.7" "@babel/types": "npm:^7.20.7" "@types/babel__generator": "npm:*" "@types/babel__template": "npm:*" "@types/babel__traverse": "npm:*" - checksum: 5b5f9de4df7f995c2f06f3fdad39b58bc30121d1f2daceb97dd423c9b5dcbd5c464959338824e0dbee0c758bf55c4e9fe46fafd13bd29c1834afad04f291c588 + checksum: 2adc7ec49de5f922271ce087cedee000de468a3e13f92b7b6254016bd8357298cb98e6d2b3c9defc69bb6e38e0c134ffe80776a8ce4e9fb167bbffcb4d7613b7 languageName: node linkType: hard @@ -3075,18 +3075,18 @@ __metadata: linkType: hard "@types/emoji-mart@npm:^3.0.9": - version: 3.0.11 - resolution: "@types/emoji-mart@npm:3.0.11" + version: 3.0.12 + resolution: "@types/emoji-mart@npm:3.0.12" dependencies: "@types/react": "npm:*" - checksum: 1080ee6d0286248310b1f29ed7e21f15bdb587dec924dc2f714ab60f9ecc4567dde84fb73e41336d72a3e77afd2546f3025f886474391dd5efe1884a6a8ef034 + checksum: 146abafe3ce9f4954c7f6ed3603bdc5a897b2d6b99dd9da6065ef597a9a6a59fb914e907decbda29b661216ddf3da8bb34a28d50f3d6929efce2b3c42e73b085 languageName: node linkType: hard "@types/escape-html@npm:^1.0.2": - version: 1.0.3 - resolution: "@types/escape-html@npm:1.0.3" - checksum: 980ec83f07f91389ffc9d7043da40db49dc40879a57f743a422bf30aa1d730f33c880baab4b31aacce550f2b195a866ec95d66a14c517ea1416d03e9b462df9d + version: 1.0.4 + resolution: "@types/escape-html@npm:1.0.4" + checksum: 5cdae9d38e97b1ad61180528ef7ca66bf6be96e875cc560c3e064d6ca75ccf2adaf2fa3b7bdd4f7494013e4357a2fb0bb62f2e59ca53097d5c45c7519d0ce9c3 languageName: node linkType: hard @@ -3127,14 +3127,14 @@ __metadata: linkType: hard "@types/express@npm:^4.17.17": - version: 4.17.20 - resolution: "@types/express@npm:4.17.20" + version: 4.17.21 + resolution: "@types/express@npm:4.17.21" dependencies: "@types/body-parser": "npm:*" "@types/express-serve-static-core": "npm:^4.17.33" "@types/qs": "npm:*" "@types/serve-static": "npm:*" - checksum: f73f5f92bd0a0fa4697598be3122c89522caa9e3bcb14c28b5e6d58a8e47f0301027478997153ae9ee4cf3d432576fb3fb0918ea0db521cc1204f8b759828a32 + checksum: 12e562c4571da50c7d239e117e688dc434db1bac8be55613294762f84fd77fbd0658ccd553c7d3ab02408f385bc93980992369dd30e2ecd2c68c358e6af8fabf languageName: node linkType: hard @@ -3165,12 +3165,12 @@ __metadata: linkType: hard "@types/hoist-non-react-statics@npm:^3.3.1": - version: 3.3.4 - resolution: "@types/hoist-non-react-statics@npm:3.3.4" + version: 3.3.5 + resolution: "@types/hoist-non-react-statics@npm:3.3.5" dependencies: "@types/react": "npm:*" hoist-non-react-statics: "npm:^3.3.0" - checksum: 677ddcacf72f2fb79f65599189d4741fa3d815aa5e50c7fd6c3c9be92298aecf05b044e7dc445cf2bb0877652293949a7f0e364e63d9266b242cd9cb9bf53fa7 + checksum: 2a3b64bf3d9817d7830afa60ee314493c475fb09570a64e7737084cd482d2177ebdddf888ce837350bac51741278b077683facc9541f052d4bbe8487b4e3e618 languageName: node linkType: hard @@ -3182,18 +3182,18 @@ __metadata: linkType: hard "@types/http-link-header@npm:^1.0.3": - version: 1.0.4 - resolution: "@types/http-link-header@npm:1.0.4" + version: 1.0.5 + resolution: "@types/http-link-header@npm:1.0.5" dependencies: "@types/node": "npm:*" - checksum: 65035f11a49a2c4ea75a0a8de284a8808264e0a1b03e6be5cd8df8637b283be154f723d2eef091715ad3e98b8d252bc261aea109559e43702dfecae03e26263e + checksum: adeb13381b38c3625478149820772924c154b4a7250dca62c346810a8378f8968fc7f3a9a4f55ec61de5d06083637540f862c8a920f6a710310c9645d19a077d languageName: node linkType: hard "@types/intl@npm:^1.2.0": - version: 1.2.1 - resolution: "@types/intl@npm:1.2.1" - checksum: b1c81eade8a9b7ee33b7642283b7d024c263d34c5efae24a517822bd87b8a01c1a2a8c71ade948346c785abad522858ec389247031b5404307c06ba51da52385 + version: 1.2.2 + resolution: "@types/intl@npm:1.2.2" + checksum: f465c320139c01dfc9ae1382406259fd23f6a455aad31517f61b7fd79bdde493e854d6666c2198ae644d8cf6e147e78831ea810f83a787f65b765bc56834f259 languageName: node linkType: hard @@ -3223,19 +3223,19 @@ __metadata: linkType: hard "@types/jest@npm:^29.5.2": - version: 29.5.7 - resolution: "@types/jest@npm:29.5.7" + version: 29.5.8 + resolution: "@types/jest@npm:29.5.8" dependencies: expect: "npm:^29.0.0" pretty-format: "npm:^29.0.0" - checksum: 231c873f3d1ddac973b8f8f2ad7760677d941d85fb52d1c5dc4a311bafba4c2c1658a1040fd7054a51f4d1841f51c6ca4cabf70675ee4fa9e10fc5b8066e1de1 + checksum: a28e7827ea7e1a2aace6a386868fa6b8402c162d6c71570aed2c29d3745ddc22ceef6899a20643071817905d3c57b670a7992fc8760bff65939351fd4dc481cf languageName: node linkType: hard "@types/js-yaml@npm:^4.0.5": - version: 4.0.8 - resolution: "@types/js-yaml@npm:4.0.8" - checksum: 171a5c54d5b5c86a89300d14a004c49321f1a290fd2f625e2ef682e100ce78715a0eb8eac1ff09114dadaec8ccdb98251ddb5e06f1f3d6aa2ec83930e7a16039 + version: 4.0.9 + resolution: "@types/js-yaml@npm:4.0.9" + checksum: 24de857aa8d61526bbfbbaa383aa538283ad17363fcd5bb5148e2c7f604547db36646440e739d78241ed008702a8920665d1add5618687b6743858fae00da211 languageName: node linkType: hard @@ -3272,9 +3272,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.14.195": - version: 4.14.200 - resolution: "@types/lodash@npm:4.14.200" - checksum: 7a8dac6dc866f10d1888846d6189d1faeb4f65adb139f0837a005fd1adcde62e60d7e7abb1a2733d13fc57bebb337d74182d8ad3dbd1d211dcd0c310c47e81bc + version: 4.14.201 + resolution: "@types/lodash@npm:4.14.201" + checksum: 14dc43787296c429433d7d034ed47c5ac24b92217056f80a0e6c990449120b9c9c1058918188945fb88353c0c8333c5c36dccc40c51edbd39b05d2169ab2e0ad languageName: node linkType: hard @@ -3330,18 +3330,18 @@ __metadata: linkType: hard "@types/npmlog@npm:^4.1.4": - version: 4.1.5 - resolution: "@types/npmlog@npm:4.1.5" + version: 4.1.6 + resolution: "@types/npmlog@npm:4.1.6" dependencies: "@types/node": "npm:*" - checksum: 84b01941e0bc9c4e1ee145ee1278731e4a1d4236a88c62f94640a741aa323df7a20ff20344432f574184fa2b219ca7f7b549f724684cab4bc8dada7b3a13941c + checksum: 432bfb14b29a383e095e099b2ddff4266051b43bc6c7ea242d10194acde2f1181a1e967bbb543f07979dd77743ead1954abac1128ec78cc2b86a5f7ea841ddcb languageName: node linkType: hard "@types/object-assign@npm:^4.0.30": - version: 4.0.32 - resolution: "@types/object-assign@npm:4.0.32" - checksum: 25a75c2c1f4b20ce95443ab247b153dfb00e4bf08b4716f01efae7063f6e49a8af96f4c752dc3a44d7da381b9730249b3ee97900b6336bf5221f242c9532e8c5 + version: 4.0.33 + resolution: "@types/object-assign@npm:4.0.33" + checksum: 7fbc399aa1140beff35a152e206bfb336dd880721f4a13cc1ea01d964ab376fa4ca2c19059145cbd777c9d3eaf724008faec8cf3becff97353c69560196af086 languageName: node linkType: hard @@ -3353,13 +3353,13 @@ __metadata: linkType: hard "@types/pg@npm:^8.6.6": - version: 8.10.7 - resolution: "@types/pg@npm:8.10.7" + version: 8.10.9 + resolution: "@types/pg@npm:8.10.9" dependencies: "@types/node": "npm:*" pg-protocol: "npm:*" pg-types: "npm:^4.0.1" - checksum: beea456e9f4011d07e318b57d8c96af26379c658ad30d242a3194520d41406ca7bfa19a941405b7db36e401aa07f34cd035bdc5ac3d7681712c47a48df3cd09e + checksum: 6b3bec7230d09da6459636a66dfd6fb538378e466ffff0a0bcd07d67aa4ddce49c73afc7442f53adec92a49dbf9e71d8d847e0075750d7545331735dfd92d22c languageName: node linkType: hard @@ -3371,16 +3371,16 @@ __metadata: linkType: hard "@types/prop-types@npm:*, @types/prop-types@npm:^15.7.5": - version: 15.7.9 - resolution: "@types/prop-types@npm:15.7.9" - checksum: e2a7373b91a8eb30cb4e399ef5b3a14baa7d72eed1667ef5e3cb1e9400edfca9b60c20b845fefdcf7562773829f6ff60ba350b09f6313a8093e70c15b2b88f00 + version: 15.7.10 + resolution: "@types/prop-types@npm:15.7.10" + checksum: 964348d05cdf7399260b3179fbd1462b23d7452dc39fbccb319e54ed6ffafb0a01c0a62c3e6f7c944a635c7a4ad5c99d62c4787c9c4b74e2ec07aebaf6cfedc1 languageName: node linkType: hard "@types/punycode@npm:^2.1.0": - version: 2.1.1 - resolution: "@types/punycode@npm:2.1.1" - checksum: 3e5c3c786790111ac497d7a472c762671c68ec58edce0a88757c503e997eb500af1b8584c948b0a9927394b0f15828faa8f986130eb4ebb0fde0331c2f515630 + version: 2.1.2 + resolution: "@types/punycode@npm:2.1.2" + checksum: 4a748533bde61097f205638b3acc2c3b0e25382d2c35a2e3b60c33c904afbad158ef778ae3e1b3f3c84edd7b04b6d9fa049f2832210c308d3fee77ba7b637cb9 languageName: node linkType: hard @@ -3406,39 +3406,39 @@ __metadata: linkType: hard "@types/react-dom@npm:^18.0.0, @types/react-dom@npm:^18.2.4": - version: 18.2.14 - resolution: "@types/react-dom@npm:18.2.14" + version: 18.2.15 + resolution: "@types/react-dom@npm:18.2.15" dependencies: "@types/react": "npm:*" - checksum: 1f79a7708d038cd651bdb21e01a99c594761bc9a40a565abe98958e1d27facfeb6e9824ddf6ae3504e7a56568f0f3da2380fe52ac18477b5864d2d5cf1386a9e + checksum: 70e86f15f69f89b8f179139ab2e8a8aa9765e742789f5dd5a46fec40d4300ada8fe3349cceda42b9964a018982d7ccb7d791b47f781966c992bfd37da909fbd3 languageName: node linkType: hard "@types/react-helmet@npm:^6.1.6": - version: 6.1.8 - resolution: "@types/react-helmet@npm:6.1.8" + version: 6.1.9 + resolution: "@types/react-helmet@npm:6.1.9" dependencies: "@types/react": "npm:*" - checksum: 56efbf05594437fff87466853b813c0672b33fbed1f995b9eb68e1461875cd5276b36c7fbc171134e9b7b897316123ae59b0263742d5a81e28ead133a4962bd2 + checksum: d1823582903d6e70f1f447c7bec9e844b6f85f5de84cbcde5c8bbeecc064db1394c786ed9b9ded30544afe5c91e57c7e8105171df1643998f64c0aeab9f7f2aa languageName: node linkType: hard "@types/react-immutable-proptypes@npm:^2.1.0": - version: 2.1.2 - resolution: "@types/react-immutable-proptypes@npm:2.1.2" + version: 2.1.3 + resolution: "@types/react-immutable-proptypes@npm:2.1.3" dependencies: "@types/prop-types": "npm:*" immutable: "npm:^3.8.2" - checksum: 8a944de2b4b484e9685495dee7b350a88e4fcba47dcecf97c7b4add6ae66b61fc61c18e877a9b8e8d453e7c4714c481166d5531328f92b2d20d45e11389734ee + checksum: 4dab74a43a2dde9bea6299a999dd600ae82f00082fe2b8865b11e5154e658f72fbb117132fa3753dd9a280dd8032a2574d8e7c94de5e268afdadd50d720086da languageName: node linkType: hard -"@types/react-motion@npm:^0.0.36": - version: 0.0.36 - resolution: "@types/react-motion@npm:0.0.36" +"@types/react-motion@npm:^0.0.37": + version: 0.0.37 + resolution: "@types/react-motion@npm:0.0.37" dependencies: "@types/react": "npm:*" - checksum: b039d9b6773a08292253f1343ee7c1c5ad2885499685aef2a0274a84a7bbe4e198b7aafa62b9c269fb37df9e076ae46ee9717fc53f0c26ca182342aaf1653139 + checksum: 387f60636d9bdd2e765ce94db969cf762a62495e32807f88380748a74e9beeb3d8e17c3ec334dab8040244ea62e7954d5f4d4bdbdd0ecc8985eb4a6ce465b61c languageName: node linkType: hard @@ -3482,29 +3482,29 @@ __metadata: linkType: hard "@types/react-sparklines@npm:^1.7.2": - version: 1.7.4 - resolution: "@types/react-sparklines@npm:1.7.4" + version: 1.7.5 + resolution: "@types/react-sparklines@npm:1.7.5" dependencies: "@types/react": "npm:*" - checksum: 1f50232fbd26d2b81508f68dbe1865503b1f9e053aae4ea2d610c771da219af4e6fa86e58fda542e2762f533042f83acab2d977ae2cb1b518ed94ba31aac8504 + checksum: acb0937ebc06019921ec5254fb125356f206038f5e2f244663eb849c692b6f6413f75ce3ee84be91d8c659ae43c8f743dd5c4397cdea65749cd601a495491242 languageName: node linkType: hard "@types/react-swipeable-views@npm:^0.13.1": - version: 0.13.4 - resolution: "@types/react-swipeable-views@npm:0.13.4" + version: 0.13.5 + resolution: "@types/react-swipeable-views@npm:0.13.5" dependencies: "@types/react": "npm:*" - checksum: 673e96a66443b07c5640c94b214fd0780846ba9e983c821f7cc7c8bdc0ab512e65b6a2af7e4aeb0f565ee5a63f30cf2bdf4d9da7a4d9d3dfe2e27d2d8f6c1200 + checksum: d1dcc78d862f37d30a43d79d915fdb388e05dce0b2ac07462ca4f1b00e0eef37cb41d75997f5685dec79bcce1ffee0dfbc744f20d5266dd3090658def5b4e193 languageName: node linkType: hard "@types/react-test-renderer@npm:^18.0.0": - version: 18.0.5 - resolution: "@types/react-test-renderer@npm:18.0.5" + version: 18.0.6 + resolution: "@types/react-test-renderer@npm:18.0.6" dependencies: "@types/react": "npm:*" - checksum: bd98abad08d04081bcf335fa71c450b9f0535ccba2c1395d11254427e1007a228d481d6868879d23b6239c0fede790de77ef6bf31afc735241e3edc63bb0e865 + checksum: f490d4379e8d095f8fa91700ceb37d0fe5a96d7cc0c51e9d7127fc3d2dc4e37a382dd6215b295b300037985cb8938cb5088130102ad14b79e4622e7e520c5a3b languageName: node linkType: hard @@ -3518,11 +3518,11 @@ __metadata: linkType: hard "@types/react-toggle@npm:^4.0.3": - version: 4.0.4 - resolution: "@types/react-toggle@npm:4.0.4" + version: 4.0.5 + resolution: "@types/react-toggle@npm:4.0.5" dependencies: "@types/react": "npm:*" - checksum: 86015101f1ddfd2c31396a8f4fff7b2b442af886ed1301b4470d864b41bec91c46046d3a4e1d97a838c3069138db2f9628f885a7d9f95199bfa27a46d9df33de + checksum: f557b85c96715b145bcc3beb2903f88ee3a6045ef85da0f80561c7cc2ecdc531e2d4ae121ed8ec3a1761264de25b8410653744093f37abf042201587add7ffa6 languageName: node linkType: hard @@ -3536,30 +3536,30 @@ __metadata: linkType: hard "@types/react@npm:*, @types/react@npm:16 || 17 || 18, @types/react@npm:>=16.9.11, @types/react@npm:^18.2.7": - version: 18.2.36 - resolution: "@types/react@npm:18.2.36" + version: 18.2.37 + resolution: "@types/react@npm:18.2.37" dependencies: "@types/prop-types": "npm:*" "@types/scheduler": "npm:*" csstype: "npm:^3.0.2" - checksum: 02b593041e9c25aaf519b5e4f87282aff559c0f3db214d7db68fee714d8286c09ab1fced68184fbe814e061019024bb479bbcd38b07985e3e794d98c96c49123 + checksum: 79dd5d23da05bec54e7423ca17096e345eb8fd80a3bf8dd916bb5cdd60677d27c298523aa5b245d090fcc4ec100cfd58c1af4631fbac709d0a9d8be75f9d78a9 languageName: node linkType: hard "@types/redux-immutable@npm:^4.0.3": - version: 4.0.5 - resolution: "@types/redux-immutable@npm:4.0.5" + version: 4.0.6 + resolution: "@types/redux-immutable@npm:4.0.6" dependencies: immutable: "npm:^4.0.0-rc.1" redux: "npm:^4.0.0" - checksum: 1fd808b86506b8d32745159397172fcc9e890766b4330a001c35254d695edeb142d2a17c7ad6592853dfccea1840e632634651bcd0af882f445699d1238813dd + checksum: 19972c307f2bbd31a201b28844224ce06e34917823cf2ded3c303cffcced273a2107c4186cc37af9db4f948204fc48c461e609b9f3d2719963049dedae3ebf82 languageName: node linkType: hard "@types/requestidlecallback@npm:^0.3.5": - version: 0.3.6 - resolution: "@types/requestidlecallback@npm:0.3.6" - checksum: 5a3df7a028fc6894446c14a67c93186f7978cf97d41a0da74a56d4c95ca9580593eb7baaaa385fa54d46f3c93f5789b21548a3708a5a0cc08302aa7e7f037e30 + version: 0.3.7 + resolution: "@types/requestidlecallback@npm:0.3.7" + checksum: aa5d1d981d7ddc98b9212c75c89d2ddb2e521077d6c0c5e285d944a8c6ae8baeec30d4d201aec31716d668d3435f884e80e768e28d929a5b87a55097bc21a5e1 languageName: node linkType: hard @@ -3659,9 +3659,9 @@ __metadata: linkType: hard "@types/uuid@npm:^9.0.0": - version: 9.0.6 - resolution: "@types/uuid@npm:9.0.6" - checksum: 8fb6b3a583a035b8e917192eeadaadadfbfd29315094aafd3478e11f11a986cb118ee0f388b15035fda063d9f1a32fa62e7a791215b762fe1e2c177929ca7146 + version: 9.0.7 + resolution: "@types/uuid@npm:9.0.7" + checksum: b329ebd4f9d1d8e08d4f2cc211be4922d70d1149f73d5772630e4a3acfb5170c6d37b3d7a39a0412f1a56e86e8a844c7f297c798b082f90380608bf766688787 languageName: node linkType: hard @@ -3684,8 +3684,8 @@ __metadata: linkType: hard "@types/webpack@npm:^4.41.33": - version: 4.41.35 - resolution: "@types/webpack@npm:4.41.35" + version: 4.41.36 + resolution: "@types/webpack@npm:4.41.36" dependencies: "@types/node": "npm:*" "@types/tapable": "npm:^1" @@ -3693,7 +3693,7 @@ __metadata: "@types/webpack-sources": "npm:*" anymatch: "npm:^3.0.0" source-map: "npm:^0.6.0" - checksum: ec6b9fda027ff6f7f9efeb4bcfb37607a15fe1e2f2f0883e3500fe474ba0a127ea62783cd19859bbef921cfad22cd680e50bcc2c1963482c6486263886877130 + checksum: 9e9021049b8f7482ec7c45e95d7c1da3604ee04481d7550421ed58f201f66edb8eb6c26b85be94ce3f761874cdbb8b570827becdaf5acdb1897aba9b7f226252 languageName: node linkType: hard @@ -3705,11 +3705,11 @@ __metadata: linkType: hard "@types/yargs@npm:^17.0.24, @types/yargs@npm:^17.0.8": - version: 17.0.29 - resolution: "@types/yargs@npm:17.0.29" + version: 17.0.31 + resolution: "@types/yargs@npm:17.0.31" dependencies: "@types/yargs-parser": "npm:*" - checksum: d8c965c101f7ee3e2f301c02a83dfd5680e4d999d3503c788c13f336868f03ee1498f019552e7d357635a1a36912cbe6751a563e9c339075d30cd131dc361c98 + checksum: 1e04df99bd0ad8ac8b3748b6ac0e99a9a4efe20b9cd8eab69ac9503fe87ab9bec312ad56982e969cdb0e2c0679431434ad571f6934049adb15fa35b22810c867 languageName: node linkType: hard From da5940752055369451e545c664aecdfb3821960b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:40:50 +0100 Subject: [PATCH 03/15] Update eslint (non-major) (#27831) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 337 +++++++++++++++++++++------------------------------ 2 files changed, 140 insertions(+), 199 deletions(-) diff --git a/package.json b/package.json index 6f20b98bcf..2230b20ea7 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,7 @@ "eslint-plugin-formatjs": "^4.10.1", "eslint-plugin-import": "~2.29.0", "eslint-plugin-jsdoc": "^46.1.0", - "eslint-plugin-jsx-a11y": "~6.7.1", + "eslint-plugin-jsx-a11y": "~6.8.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-promise": "~6.1.1", "eslint-plugin-react": "~7.33.0", diff --git a/yarn.lock b/yarn.lock index b05b2bfbce..e8fe28fb46 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1482,7 +1482,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.0, @babel/runtime@npm:^7.12.1, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.2.0, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.22.3, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.3, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": +"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.0, @babel/runtime@npm:^7.12.1, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.2.0, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.22.3, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.3, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": version: 7.23.2 resolution: "@babel/runtime@npm:7.23.2" dependencies: @@ -1697,14 +1697,14 @@ __metadata: languageName: node linkType: hard -"@es-joy/jsdoccomment@npm:~0.40.1": - version: 0.40.1 - resolution: "@es-joy/jsdoccomment@npm:0.40.1" +"@es-joy/jsdoccomment@npm:~0.41.0": + version: 0.41.0 + resolution: "@es-joy/jsdoccomment@npm:0.41.0" dependencies: - comment-parser: "npm:1.4.0" + comment-parser: "npm:1.4.1" esquery: "npm:^1.5.0" jsdoc-type-pratt-parser: "npm:~4.0.0" - checksum: e66b861c55cf26d22c0facef911d65abbbbf633a9fc47cbf0f0faa4226e495cbce5133f4e69f555cd4c018a13dabb37f8a36d631ba768b9297913154b06a04af + checksum: 1fa27531eba32e4699664da53a0865aeeda1f7e83ac156fe53b7a6b09d2f3816baa94a34845ff019c10289b09572bda5519ec917e3e241088975477fa880f72d languageName: node linkType: hard @@ -1790,16 +1790,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/ecma402-abstract@npm:1.17.2": - version: 1.17.2 - resolution: "@formatjs/ecma402-abstract@npm:1.17.2" - dependencies: - "@formatjs/intl-localematcher": "npm:0.4.2" - tslib: "npm:^2.4.0" - checksum: 7086962b6f6fd517188e9640e8439062e125e7bd60852ae91ceadb259fceaa3f73f7403a77411a7c82b1ae60be4bf4b27f793acc4059214adc91b00682d880fe - languageName: node - linkType: hard - "@formatjs/ecma402-abstract@npm:1.17.4": version: 1.17.4 resolution: "@formatjs/ecma402-abstract@npm:1.17.4" @@ -1819,17 +1809,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/icu-messageformat-parser@npm:2.7.0": - version: 2.7.0 - resolution: "@formatjs/icu-messageformat-parser@npm:2.7.0" - dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.2" - "@formatjs/icu-skeleton-parser": "npm:1.6.2" - tslib: "npm:^2.4.0" - checksum: f671d3dfcfa8ada17d14388f21be4cf1c535cbad8aba9cd6a3132d3120424cb7fb090f67b27e44ffbd0c7d4bba9f20e76b74cfca87f4ab945939e7ea3acb878c - languageName: node - linkType: hard - "@formatjs/icu-messageformat-parser@npm:2.7.2": version: 2.7.2 resolution: "@formatjs/icu-messageformat-parser@npm:2.7.2" @@ -1841,16 +1820,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/icu-skeleton-parser@npm:1.6.2": - version: 1.6.2 - resolution: "@formatjs/icu-skeleton-parser@npm:1.6.2" - dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.2" - tslib: "npm:^2.4.0" - checksum: 2a2a56f49a15e8122b37237d5e09a817e01149ae353e1b5fe8721d1789dbaee85995c897d3aa9e5b400e3ee05b5fd4c0721b3ad49b1d128954dfed873a793153 - languageName: node - linkType: hard - "@formatjs/icu-skeleton-parser@npm:1.6.4": version: 1.6.4 resolution: "@formatjs/icu-skeleton-parser@npm:1.6.4" @@ -1883,15 +1852,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/intl-localematcher@npm:0.4.2": - version: 0.4.2 - resolution: "@formatjs/intl-localematcher@npm:0.4.2" - dependencies: - tslib: "npm:^2.4.0" - checksum: 2521fa48a95a80e3bedc0d444fb2ef67e1215e0bf9e6d16020c4a22af6973849a71c7a29a10cb74fc67b818967e9f8672062760e808e70873132277830e0ec67 - languageName: node - linkType: hard - "@formatjs/intl-localematcher@npm:0.5.1": version: 0.5.1 resolution: "@formatjs/intl-localematcher@npm:0.5.1" @@ -1932,26 +1892,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/ts-transformer@npm:3.13.6": - version: 3.13.6 - resolution: "@formatjs/ts-transformer@npm:3.13.6" - dependencies: - "@formatjs/icu-messageformat-parser": "npm:2.7.0" - "@types/json-stable-stringify": "npm:^1.0.32" - "@types/node": "npm:14 || 16 || 17" - chalk: "npm:^4.0.0" - json-stable-stringify: "npm:^1.0.1" - tslib: "npm:^2.4.0" - typescript: "npm:5" - peerDependencies: - ts-jest: ">=27" - peerDependenciesMeta: - ts-jest: - optional: true - checksum: 76cd99713a974bf63081d9f7b98997dba0fc998205b5bc7cb6249dc8572549408b62a42c394b6d589905368203b37862e0c9248eef5aaa94b8de0b423fa8b508 - languageName: node - linkType: hard - "@formatjs/ts-transformer@npm:3.13.8": version: 3.13.8 resolution: "@formatjs/ts-transformer@npm:3.13.8" @@ -2432,7 +2372,7 @@ __metadata: eslint-plugin-formatjs: "npm:^4.10.1" eslint-plugin-import: "npm:~2.29.0" eslint-plugin-jsdoc: "npm:^46.1.0" - eslint-plugin-jsx-a11y: "npm:~6.7.1" + eslint-plugin-jsx-a11y: "npm:~6.8.0" eslint-plugin-prettier: "npm:^5.0.0" eslint-plugin-promise: "npm:~6.1.1" eslint-plugin-react: "npm:~7.33.0" @@ -3714,14 +3654,14 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^6.0.0": - version: 6.9.1 - resolution: "@typescript-eslint/eslint-plugin@npm:6.9.1" + version: 6.10.0 + resolution: "@typescript-eslint/eslint-plugin@npm:6.10.0" dependencies: "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:6.9.1" - "@typescript-eslint/type-utils": "npm:6.9.1" - "@typescript-eslint/utils": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" + "@typescript-eslint/scope-manager": "npm:6.10.0" + "@typescript-eslint/type-utils": "npm:6.10.0" + "@typescript-eslint/utils": "npm:6.10.0" + "@typescript-eslint/visitor-keys": "npm:6.10.0" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.4" @@ -3734,44 +3674,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: f2455fe74f8c90d82df97801ee5e17bb3d81b1a59d23eedc7cad95b6eed30180339107bef0460578d5cc587033bb388fd112bae48b6b85f504fe4521f365ac69 + checksum: f50b17cb753afbfc99549d38585eba8558949b977eb4661dd584e73ee946b3dbe944c9e3b12a233fa06b5e1c7d101730ac88a00c7a91b0a7f1e2c37a98e13c7a languageName: node linkType: hard "@typescript-eslint/parser@npm:^6.0.0": - version: 6.9.1 - resolution: "@typescript-eslint/parser@npm:6.9.1" + version: 6.10.0 + resolution: "@typescript-eslint/parser@npm:6.10.0" dependencies: - "@typescript-eslint/scope-manager": "npm:6.9.1" - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/typescript-estree": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" + "@typescript-eslint/scope-manager": "npm:6.10.0" + "@typescript-eslint/types": "npm:6.10.0" + "@typescript-eslint/typescript-estree": "npm:6.10.0" + "@typescript-eslint/visitor-keys": "npm:6.10.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: a6896655b2005a55e15dd3bb8b8239e1cb1bb0379037f6af2409e910c426cf9cda5490d45cd1857a3ca7fe2727acc8250d8196770147a4dc274e4c700ead9d9c + checksum: fd86c31dfdde03636393a3a9cf16716856bb506923069f34d87af14fac363a33578f47476a15d272e4d7a764de00fd905ee11361cc06b81b302a9fa8ebe4c23c languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/scope-manager@npm:6.9.1" +"@typescript-eslint/scope-manager@npm:6.10.0": + version: 6.10.0 + resolution: "@typescript-eslint/scope-manager@npm:6.10.0" dependencies: - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" - checksum: 53fa7c3813d22b119e464f9b6d7d23407dfe103ee8ad2dcacf9ad6d656fda20e2bb3346df39e62b0e6b6ce71572ce5838071c5d2cca6daa4e0ce117ff22eafe5 + "@typescript-eslint/types": "npm:6.10.0" + "@typescript-eslint/visitor-keys": "npm:6.10.0" + checksum: a5fbee770d763852a7f426b950d495529139f1629fdcb30136c93f787acd82236db4272f78dff1d05a3a10a6406472ae95ae94ab75cfb618a06d75b8cc536cbf languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/type-utils@npm:6.9.1" +"@typescript-eslint/type-utils@npm:6.10.0": + version: 6.10.0 + resolution: "@typescript-eslint/type-utils@npm:6.10.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:6.9.1" - "@typescript-eslint/utils": "npm:6.9.1" + "@typescript-eslint/typescript-estree": "npm:6.10.0" + "@typescript-eslint/utils": "npm:6.10.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.0.1" peerDependencies: @@ -3779,23 +3719,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 9373c32c9bce736527e01baabc1dbee4b7f43774ebdcbbe20ee9cf61d1b01e7faab3d5df1ebbe75241308c52eabbc9500dd7826701f95caee4054ca659420304 + checksum: f7c425d4da4d53d78b3d6630216dc1f2809f8dcaed62dc3cf12252102a53103a2aa39a160b310ca1cedebf87b8c339013be0c2360710c7c836b775374730c10e languageName: node linkType: hard -"@typescript-eslint/types@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/types@npm:6.9.1" - checksum: 4ba21ba18e256da210a4caedfbc5d4927cf8cb4f2c4d74f8ccc865576f3659b974e79119d3c94db2b68a4cec9cd687e43971d355450b7082d6d1736a5dd6db85 +"@typescript-eslint/types@npm:6.10.0": + version: 6.10.0 + resolution: "@typescript-eslint/types@npm:6.10.0" + checksum: 30f47de625405b3729db6d26a0376d98628bd966c70ca01fab1adcef91bba810d27ce643d844e42d1cc77bb2c6277e62efe278a090da63ba748dfe5710c4757b languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" +"@typescript-eslint/typescript-estree@npm:6.10.0": + version: 6.10.0 + resolution: "@typescript-eslint/typescript-estree@npm:6.10.0" dependencies: - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/visitor-keys": "npm:6.9.1" + "@typescript-eslint/types": "npm:6.10.0" + "@typescript-eslint/visitor-keys": "npm:6.10.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -3804,34 +3744,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 850b1865a90107879186c3f2969968a2c08fc6fcc56d146483c297cf5be376e33d505ac81533ba8e8103ca4d2edfea7d21b178de9e52217f7ee2922f51a445fa + checksum: ca28ca5a55e2d431c649ad093e4a4302f2b37c430bbeebbe622b05c727fd14dab136aead5a96848499d3ff4d187889733f8871b8dd5205d19bed4a260ad74544 languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.9.1, @typescript-eslint/utils@npm:^6.5.0": - version: 6.9.1 - resolution: "@typescript-eslint/utils@npm:6.9.1" +"@typescript-eslint/utils@npm:6.10.0, @typescript-eslint/utils@npm:^6.5.0": + version: 6.10.0 + resolution: "@typescript-eslint/utils@npm:6.10.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.12" "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:6.9.1" - "@typescript-eslint/types": "npm:6.9.1" - "@typescript-eslint/typescript-estree": "npm:6.9.1" + "@typescript-eslint/scope-manager": "npm:6.10.0" + "@typescript-eslint/types": "npm:6.10.0" + "@typescript-eslint/typescript-estree": "npm:6.10.0" semver: "npm:^7.5.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 - checksum: 3d329d54c3d155ed29e2b456a602aef76bda1b88dfcf847145849362e4ddefabe5c95de236de750d08d5da9bedcfb2131bdfd784ce4eb87cf82728f0b6662033 + checksum: 809a1d08b154f76ed7a99edddf872369f6ed93987cea19a18cb9f12b8390bddcff9138d9d94955545da54488d59e0001054bec13baf6d858a1761b059480b887 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.9.1": - version: 6.9.1 - resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" +"@typescript-eslint/visitor-keys@npm:6.10.0": + version: 6.10.0 + resolution: "@typescript-eslint/visitor-keys@npm:6.10.0" dependencies: - "@typescript-eslint/types": "npm:6.9.1" + "@typescript-eslint/types": "npm:6.10.0" eslint-visitor-keys: "npm:^3.4.1" - checksum: ac5f375a177add30489e5b63cafa8d82a196b33624bb36418422ebe0d7973b3ba550dc7e0dda36ea75a94cf9b200b4fb5f5fb4d77c027fd801201c1a269d343b + checksum: f9223c148655ce00bb17db8aa92ee964e62c75d15095893e0b4d653c60a4033f456329b06de3eab4b404d8df359904f0dd6e3c8c842885c6d130e28ccd95ce03 languageName: node linkType: hard @@ -4347,7 +4287,7 @@ __metadata: languageName: node linkType: hard -"aria-query@npm:^5.0.0, aria-query@npm:^5.1.3": +"aria-query@npm:^5.0.0, aria-query@npm:^5.3.0": version: 5.3.0 resolution: "aria-query@npm:5.3.0" dependencies: @@ -4565,10 +4505,10 @@ __metadata: languageName: node linkType: hard -"ast-types-flow@npm:^0.0.7": - version: 0.0.7 - resolution: "ast-types-flow@npm:0.0.7" - checksum: f381529f2da535949ba6cceddbdfaa33b4d5105842e147ec63582f560ea9ecc1a08f66457664f3109841d3053641fa8b9fa94ba607f1ea9f6c804fe5dee44a1d +"ast-types-flow@npm:^0.0.8": + version: 0.0.8 + resolution: "ast-types-flow@npm:0.0.8" + checksum: f2a0ba8055353b743c41431974521e5e852a9824870cd6fce2db0e538ac7bf4da406bbd018d109af29ff3f8f0993f6a730c9eddbd0abd031fbcb29ca75c1014e languageName: node linkType: hard @@ -4675,10 +4615,10 @@ __metadata: languageName: node linkType: hard -"axe-core@npm:^4.6.2": - version: 4.7.2 - resolution: "axe-core@npm:4.7.2" - checksum: 8dfc61f038fbd9623ae8a264c8a475d887113a027fb440a2b377b82ffd300e71d1a0bcf042ff13b517a8d548b34c44b4159eff693725c5d7cde240d0aa68feac +"axe-core@npm:=4.7.0": + version: 4.7.0 + resolution: "axe-core@npm:4.7.0" + checksum: 89ac5712b5932ac7d23398b4cb5ba081c394a086e343acc68ba49c83472706e18e0799804e8388c779dcdacc465377deb29f2714241d3fbb389cf3a6b275c9ba languageName: node linkType: hard @@ -4693,7 +4633,7 @@ __metadata: languageName: node linkType: hard -"axobject-query@npm:^3.1.1": +"axobject-query@npm:^3.2.1": version: 3.2.1 resolution: "axobject-query@npm:3.2.1" dependencies: @@ -5807,10 +5747,10 @@ __metadata: languageName: node linkType: hard -"comment-parser@npm:1.4.0": - version: 1.4.0 - resolution: "comment-parser@npm:1.4.0" - checksum: c87ba95d5ff9ae380ed7aab2aa8490303652d535c0cff5b1f16a97be0633d0827d689b5e854b0003fbb6341ce22caf000a03eb1badcdfbb142d7aea8f921c12b +"comment-parser@npm:1.4.1": + version: 1.4.1 + resolution: "comment-parser@npm:1.4.1" + checksum: d6c4be3f5be058f98b24f2d557f745d8fe1cc9eb75bebbdccabd404a0e1ed41563171b16285f593011f8b6a5ec81f564fb1f2121418ac5cbf0f49255bf0840dd languageName: node linkType: hard @@ -6614,13 +6554,14 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0": - version: 1.2.0 - resolution: "define-properties@npm:1.2.0" +"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": + version: 1.2.1 + resolution: "define-properties@npm:1.2.1" dependencies: + define-data-property: "npm:^1.0.1" has-property-descriptors: "npm:^1.0.0" object-keys: "npm:^1.1.1" - checksum: 34b58cae4651936a3c8c720310ce393a3227f5123640ab5402e7d6e59bb44f8295b789cb5d74e7513682b2e60ff20586d6f52b726d964d617abffa3da76344e0 + checksum: 88a152319ffe1396ccc6ded510a3896e77efac7a1bfbaa174a7b00414a1747377e0bb525d303794a47cf30e805c2ec84e575758512c6e44a993076d29fd4e6c3 languageName: node linkType: hard @@ -7160,7 +7101,7 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.17.2, es-abstract@npm:^1.20.4, es-abstract@npm:^1.21.2, es-abstract@npm:^1.21.3, es-abstract@npm:^1.22.1": +"es-abstract@npm:^1.17.2, es-abstract@npm:^1.20.4, es-abstract@npm:^1.21.2, es-abstract@npm:^1.22.1": version: 1.22.3 resolution: "es-abstract@npm:1.22.3" dependencies: @@ -7231,14 +7172,14 @@ __metadata: languageName: node linkType: hard -"es-iterator-helpers@npm:^1.0.12": - version: 1.0.13 - resolution: "es-iterator-helpers@npm:1.0.13" +"es-iterator-helpers@npm:^1.0.12, es-iterator-helpers@npm:^1.0.15": + version: 1.0.15 + resolution: "es-iterator-helpers@npm:1.0.15" dependencies: asynciterator.prototype: "npm:^1.0.0" call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.21.3" + define-properties: "npm:^1.2.1" + es-abstract: "npm:^1.22.1" es-set-tostringtag: "npm:^2.0.1" function-bind: "npm:^1.1.1" get-intrinsic: "npm:^1.2.1" @@ -7247,9 +7188,9 @@ __metadata: has-proto: "npm:^1.0.1" has-symbols: "npm:^1.0.3" internal-slot: "npm:^1.0.5" - iterator.prototype: "npm:^1.1.0" - safe-array-concat: "npm:^1.0.0" - checksum: e6109017c432376294d5d6849cd0a5f8d9bcf5819eea612026e4401bb362d798c01e7a8984702b87d9d689c07b1146a31a99f17a761ca4e7e6470d9e8db9bea8 + iterator.prototype: "npm:^1.1.2" + safe-array-concat: "npm:^1.0.1" + checksum: b4c83f94bfe624260d5238092de3173989f76f1416b1d02c388aea3b2024174e5f5f0e864057311ac99790b57e836ca3545b6e77256b26066dac944519f5e6d6 languageName: node linkType: hard @@ -7390,11 +7331,11 @@ __metadata: linkType: hard "eslint-plugin-formatjs@npm:^4.10.1": - version: 4.11.0 - resolution: "eslint-plugin-formatjs@npm:4.11.0" + version: 4.11.2 + resolution: "eslint-plugin-formatjs@npm:4.11.2" dependencies: - "@formatjs/icu-messageformat-parser": "npm:2.7.0" - "@formatjs/ts-transformer": "npm:3.13.6" + "@formatjs/icu-messageformat-parser": "npm:2.7.2" + "@formatjs/ts-transformer": "npm:3.13.8" "@types/eslint": "npm:7 || 8" "@types/picomatch": "npm:^2.3.0" "@typescript-eslint/utils": "npm:^6.5.0" @@ -7406,7 +7347,7 @@ __metadata: unicode-emoji-utils: "npm:^1.1.1" peerDependencies: eslint: 7 || 8 - checksum: 4b1afb99d1d46e5e2200669a3918c0238b075c89ac9790f3339d9231f86c093cdd0560b7bfa79e81f99b390b9beab68b3dc8cb8dac57285db2f9b120e7f2667a + checksum: f5a6bffd9c65b9ce765be74d384618e543388720036b070d69d93c00b8c2bfded543141affc7793bf402f2c9177e2bbc395a7d1e8b806a40bfde1744c282a13c languageName: node linkType: hard @@ -7438,12 +7379,12 @@ __metadata: linkType: hard "eslint-plugin-jsdoc@npm:^46.1.0": - version: 46.8.2 - resolution: "eslint-plugin-jsdoc@npm:46.8.2" + version: 46.9.0 + resolution: "eslint-plugin-jsdoc@npm:46.9.0" dependencies: - "@es-joy/jsdoccomment": "npm:~0.40.1" + "@es-joy/jsdoccomment": "npm:~0.41.0" are-docs-informative: "npm:^0.0.2" - comment-parser: "npm:1.4.0" + comment-parser: "npm:1.4.1" debug: "npm:^4.3.4" escape-string-regexp: "npm:^4.0.0" esquery: "npm:^1.5.0" @@ -7452,33 +7393,33 @@ __metadata: spdx-expression-parse: "npm:^3.0.1" peerDependencies: eslint: ^7.0.0 || ^8.0.0 - checksum: ccf38567ddd73d7c57bf144d0fe9c1fe4a54e407353b3577bf036e9919a8ef96e7e385834ee383b64c7c2090b15a0f84a55b9dc5f50539ff399a3f7b91d26b48 + checksum: 4566b0f9bda54b446c813cf5ea93ae6d5866cbc4d448cb957b9ce2563f934d3ed2ed4e665e5a870750860a57137a1714c38599c35c60be16dce0f8e5a75b6ff6 languageName: node linkType: hard -"eslint-plugin-jsx-a11y@npm:~6.7.1": - version: 6.7.1 - resolution: "eslint-plugin-jsx-a11y@npm:6.7.1" +"eslint-plugin-jsx-a11y@npm:~6.8.0": + version: 6.8.0 + resolution: "eslint-plugin-jsx-a11y@npm:6.8.0" dependencies: - "@babel/runtime": "npm:^7.20.7" - aria-query: "npm:^5.1.3" - array-includes: "npm:^3.1.6" - array.prototype.flatmap: "npm:^1.3.1" - ast-types-flow: "npm:^0.0.7" - axe-core: "npm:^4.6.2" - axobject-query: "npm:^3.1.1" + "@babel/runtime": "npm:^7.23.2" + aria-query: "npm:^5.3.0" + array-includes: "npm:^3.1.7" + array.prototype.flatmap: "npm:^1.3.2" + ast-types-flow: "npm:^0.0.8" + axe-core: "npm:=4.7.0" + axobject-query: "npm:^3.2.1" damerau-levenshtein: "npm:^1.0.8" emoji-regex: "npm:^9.2.2" - has: "npm:^1.0.3" - jsx-ast-utils: "npm:^3.3.3" - language-tags: "npm:=1.0.5" + es-iterator-helpers: "npm:^1.0.15" + hasown: "npm:^2.0.0" + jsx-ast-utils: "npm:^3.3.5" + language-tags: "npm:^1.0.9" minimatch: "npm:^3.1.2" - object.entries: "npm:^1.1.6" - object.fromentries: "npm:^2.0.6" - semver: "npm:^6.3.0" + object.entries: "npm:^1.1.7" + object.fromentries: "npm:^2.0.7" peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - checksum: 41ad3d0c8036b36cd475685c1ad639157f403b16e8ac23c07f1dbe0226ccf8458f2805cbd5cc8e56856a5d8a356f3276e3139274d819476ccad80c41b9245502 + checksum: 199b883e526e6f9d7c54cb3f094abc54f11a1ec816db5fb6cae3b938eb0e503acc10ccba91ca7451633a9d0b9abc0ea03601844a8aba5fe88c5e8897c9ac8f49 languageName: node linkType: hard @@ -10039,16 +9980,16 @@ __metadata: languageName: node linkType: hard -"iterator.prototype@npm:^1.1.0": - version: 1.1.0 - resolution: "iterator.prototype@npm:1.1.0" +"iterator.prototype@npm:^1.1.2": + version: 1.1.2 + resolution: "iterator.prototype@npm:1.1.2" dependencies: - define-properties: "npm:^1.1.4" - get-intrinsic: "npm:^1.1.3" + define-properties: "npm:^1.2.1" + get-intrinsic: "npm:^1.2.1" has-symbols: "npm:^1.0.3" - has-tostringtag: "npm:^1.0.0" - reflect.getprototypeof: "npm:^1.0.3" - checksum: fd641c4cc8cf85a1f99c772722589393b6b59562c7b73cae6bea26e0814b9bdd095d40818f061b85a4f386ecebee92f9a01ba79a70951d72bd3dd3e01a6c624c + reflect.getprototypeof: "npm:^1.0.4" + set-function-name: "npm:^2.0.1" + checksum: a32151326095e916f306990d909f6bbf23e3221999a18ba686419535dcd1749b10ded505e89334b77dc4c7a58a8508978f0eb16c2c8573e6d412eb7eb894ea79 languageName: node linkType: hard @@ -10807,7 +10748,7 @@ __metadata: languageName: node linkType: hard -"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.3": +"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.5": version: 3.3.5 resolution: "jsx-ast-utils@npm:3.3.5" dependencies: @@ -10870,19 +10811,19 @@ __metadata: languageName: node linkType: hard -"language-subtag-registry@npm:~0.3.2": +"language-subtag-registry@npm:^0.3.20": version: 0.3.22 resolution: "language-subtag-registry@npm:0.3.22" checksum: d1e09971260a7cd3b9fdeb190d33af0b6e99c8697013537d9aaa15f7856d9d83aee128ba8078e219df0a7cf4b8dd18d1a0c188f6543b500d92a2689d2d114b70 languageName: node linkType: hard -"language-tags@npm:=1.0.5": - version: 1.0.5 - resolution: "language-tags@npm:1.0.5" +"language-tags@npm:^1.0.9": + version: 1.0.9 + resolution: "language-tags@npm:1.0.9" dependencies: - language-subtag-registry: "npm:~0.3.2" - checksum: 04215e821af9a8f1bc6c99ab5aa0a316c3fe1912ca3337eb28596316064bddd8edd22f2883d866069ebdf01b2002e504a760a336b2c728b6d30514e86744f76c + language-subtag-registry: "npm:^0.3.20" + checksum: 9ab911213c4bd8bd583c850201c17794e52cb0660d1ab6e32558aadc8324abebf6844e46f92b80a5d600d0fbba7eface2c207bfaf270a1c7fd539e4c3a880bff languageName: node linkType: hard @@ -12133,14 +12074,14 @@ __metadata: languageName: node linkType: hard -"object.entries@npm:^1.1.6": - version: 1.1.6 - resolution: "object.entries@npm:1.1.6" +"object.entries@npm:^1.1.6, object.entries@npm:^1.1.7": + version: 1.1.7 + resolution: "object.entries@npm:1.1.7" dependencies: call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - checksum: 8782c71db3a068ccbae9e0541e6b4ac2c25dc67c63f97b7e6ad3c88271d7820197e7398e37747f96542ed47c27f0b81148cdf14c42df15dc22f64818ae7bb5bf + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 3ad1899cc7bf14546bf28f4a9b363ae8690b90948fcfbcac4c808395435d760f26193d9cae95337ce0e3c1e5c1f4fa45f7b46b31b68d389e9e117fce38775d86 languageName: node linkType: hard @@ -14193,17 +14134,17 @@ __metadata: languageName: node linkType: hard -"reflect.getprototypeof@npm:^1.0.3": - version: 1.0.3 - resolution: "reflect.getprototypeof@npm:1.0.3" +"reflect.getprototypeof@npm:^1.0.4": + version: 1.0.4 + resolution: "reflect.getprototypeof@npm:1.0.4" dependencies: call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - get-intrinsic: "npm:^1.1.1" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + get-intrinsic: "npm:^1.2.1" globalthis: "npm:^1.0.3" which-builtin-type: "npm:^1.1.3" - checksum: 6300460adb743c5e710f3d0b9c2f49206a4f2a8cc61640e58565d13df3659747e82a88758666f5d32ed449ac3647cfcf0bbd48b574ceed8cb2ea14f20a719580 + checksum: 02104cdd22658b637efe6b1df73658edab539268347327c8250a72d0cb273dcdf280c284e2d94155d22601d022d16be1a816a8616d679e447cbcbde9860d15cb languageName: node linkType: hard @@ -14921,7 +14862,7 @@ __metadata: languageName: node linkType: hard -"set-function-name@npm:^2.0.0": +"set-function-name@npm:^2.0.0, set-function-name@npm:^2.0.1": version: 2.0.1 resolution: "set-function-name@npm:2.0.1" dependencies: From 0945e25b8f4ac46f6522277a3461044f37c7139b Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 13 Nov 2023 09:53:22 -0500 Subject: [PATCH 04/15] Add `Api::V1::Statuses::BaseController` base controller class (#27794) --- .../api/v1/statuses/base_controller.rb | 16 ++++++++++++++++ .../api/v1/statuses/bookmarks_controller.rb | 15 ++------------- .../favourited_by_accounts_controller.rb | 12 +----------- .../api/v1/statuses/favourites_controller.rb | 15 ++------------- .../api/v1/statuses/histories_controller.rb | 12 +----------- .../api/v1/statuses/mutes_controller.rb | 12 +----------- .../api/v1/statuses/pins_controller.rb | 9 +-------- .../statuses/reblogged_by_accounts_controller.rb | 12 +----------- .../api/v1/statuses/reblogs_controller.rb | 4 ++-- .../api/v1/statuses/sources_controller.rb | 14 +------------- .../api/v1/statuses/translations_controller.rb | 12 +----------- 11 files changed, 29 insertions(+), 104 deletions(-) create mode 100644 app/controllers/api/v1/statuses/base_controller.rb diff --git a/app/controllers/api/v1/statuses/base_controller.rb b/app/controllers/api/v1/statuses/base_controller.rb new file mode 100644 index 0000000000..3f56b68bcf --- /dev/null +++ b/app/controllers/api/v1/statuses/base_controller.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class Api::V1::Statuses::BaseController < Api::BaseController + include Authorization + + before_action :set_status + + private + + def set_status + @status = Status.find(params[:status_id]) + authorize @status, :show? + rescue Mastodon::NotPermittedError + not_found + end +end diff --git a/app/controllers/api/v1/statuses/bookmarks_controller.rb b/app/controllers/api/v1/statuses/bookmarks_controller.rb index 19963c002a..109b12f467 100644 --- a/app/controllers/api/v1/statuses/bookmarks_controller.rb +++ b/app/controllers/api/v1/statuses/bookmarks_controller.rb @@ -1,11 +1,9 @@ # frozen_string_literal: true -class Api::V1::Statuses::BookmarksController < Api::BaseController - include Authorization - +class Api::V1::Statuses::BookmarksController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :write, :'write:bookmarks' } before_action :require_user! - before_action :set_status, only: [:create] + skip_before_action :set_status, only: [:destroy] def create current_account.bookmarks.find_or_create_by!(account: current_account, status: @status) @@ -28,13 +26,4 @@ class Api::V1::Statuses::BookmarksController < Api::BaseController rescue Mastodon::NotPermittedError not_found end - - private - - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end end diff --git a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb index 73eb11e711..3cca246ce8 100644 --- a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb @@ -1,10 +1,7 @@ # frozen_string_literal: true -class Api::V1::Statuses::FavouritedByAccountsController < Api::BaseController - include Authorization - +class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::BaseController before_action -> { authorize_if_got_token! :read, :'read:accounts' } - before_action :set_status after_action :insert_pagination_headers def index @@ -61,13 +58,6 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::BaseController @accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT) end - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end - def pagination_params(core_params) params.slice(:limit).permit(:limit).merge(core_params) end diff --git a/app/controllers/api/v1/statuses/favourites_controller.rb b/app/controllers/api/v1/statuses/favourites_controller.rb index f3428e3df4..dbc75a0364 100644 --- a/app/controllers/api/v1/statuses/favourites_controller.rb +++ b/app/controllers/api/v1/statuses/favourites_controller.rb @@ -1,11 +1,9 @@ # frozen_string_literal: true -class Api::V1::Statuses::FavouritesController < Api::BaseController - include Authorization - +class Api::V1::Statuses::FavouritesController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :write, :'write:favourites' } before_action :require_user! - before_action :set_status, only: [:create] + skip_before_action :set_status, only: [:destroy] def create FavouriteService.new.call(current_account, @status) @@ -30,13 +28,4 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController rescue Mastodon::NotPermittedError not_found end - - private - - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end end diff --git a/app/controllers/api/v1/statuses/histories_controller.rb b/app/controllers/api/v1/statuses/histories_controller.rb index 2913472b04..dcb21ef043 100644 --- a/app/controllers/api/v1/statuses/histories_controller.rb +++ b/app/controllers/api/v1/statuses/histories_controller.rb @@ -1,10 +1,7 @@ # frozen_string_literal: true -class Api::V1::Statuses::HistoriesController < Api::BaseController - include Authorization - +class Api::V1::Statuses::HistoriesController < Api::V1::Statuses::BaseController before_action -> { authorize_if_got_token! :read, :'read:statuses' } - before_action :set_status def show cache_if_unauthenticated! @@ -16,11 +13,4 @@ class Api::V1::Statuses::HistoriesController < Api::BaseController def status_edits @status.edits.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)] end - - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end end diff --git a/app/controllers/api/v1/statuses/mutes_controller.rb b/app/controllers/api/v1/statuses/mutes_controller.rb index 87071a2b9a..26b92bb8af 100644 --- a/app/controllers/api/v1/statuses/mutes_controller.rb +++ b/app/controllers/api/v1/statuses/mutes_controller.rb @@ -1,11 +1,8 @@ # frozen_string_literal: true -class Api::V1::Statuses::MutesController < Api::BaseController - include Authorization - +class Api::V1::Statuses::MutesController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :write, :'write:mutes' } before_action :require_user! - before_action :set_status before_action :set_conversation def create @@ -24,13 +21,6 @@ class Api::V1::Statuses::MutesController < Api::BaseController private - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end - def set_conversation @conversation = @status.conversation raise Mastodon::ValidationError if @conversation.nil? diff --git a/app/controllers/api/v1/statuses/pins_controller.rb b/app/controllers/api/v1/statuses/pins_controller.rb index 51b1621b6f..7107890af1 100644 --- a/app/controllers/api/v1/statuses/pins_controller.rb +++ b/app/controllers/api/v1/statuses/pins_controller.rb @@ -1,11 +1,8 @@ # frozen_string_literal: true -class Api::V1::Statuses::PinsController < Api::BaseController - include Authorization - +class Api::V1::Statuses::PinsController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :write, :'write:accounts' } before_action :require_user! - before_action :set_status def create StatusPin.create!(account: current_account, status: @status) @@ -26,10 +23,6 @@ class Api::V1::Statuses::PinsController < Api::BaseController private - def set_status - @status = Status.find(params[:status_id]) - end - def distribute_add_activity! json = ActiveModelSerializers::SerializableResource.new( @status, diff --git a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb index 41672e7539..dd3e60846b 100644 --- a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb @@ -1,10 +1,7 @@ # frozen_string_literal: true -class Api::V1::Statuses::RebloggedByAccountsController < Api::BaseController - include Authorization - +class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::BaseController before_action -> { authorize_if_got_token! :read, :'read:accounts' } - before_action :set_status after_action :insert_pagination_headers def index @@ -57,13 +54,6 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::BaseController @accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT) end - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end - def pagination_params(core_params) params.slice(:limit).permit(:limit).merge(core_params) end diff --git a/app/controllers/api/v1/statuses/reblogs_controller.rb b/app/controllers/api/v1/statuses/reblogs_controller.rb index 3ca6231178..971b054c54 100644 --- a/app/controllers/api/v1/statuses/reblogs_controller.rb +++ b/app/controllers/api/v1/statuses/reblogs_controller.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -class Api::V1::Statuses::ReblogsController < Api::BaseController - include Authorization +class Api::V1::Statuses::ReblogsController < Api::V1::Statuses::BaseController include Redisable include Lockable before_action -> { doorkeeper_authorize! :write, :'write:statuses' } before_action :require_user! before_action :set_reblog, only: [:create] + skip_before_action :set_status override_rate_limit_headers :create, family: :statuses diff --git a/app/controllers/api/v1/statuses/sources_controller.rb b/app/controllers/api/v1/statuses/sources_controller.rb index 4340864513..5ceda4c7ef 100644 --- a/app/controllers/api/v1/statuses/sources_controller.rb +++ b/app/controllers/api/v1/statuses/sources_controller.rb @@ -1,21 +1,9 @@ # frozen_string_literal: true -class Api::V1::Statuses::SourcesController < Api::BaseController - include Authorization - +class Api::V1::Statuses::SourcesController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :read, :'read:statuses' } - before_action :set_status def show render json: @status, serializer: REST::StatusSourceSerializer end - - private - - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end end diff --git a/app/controllers/api/v1/statuses/translations_controller.rb b/app/controllers/api/v1/statuses/translations_controller.rb index ec5ea5b85b..7d406b0a36 100644 --- a/app/controllers/api/v1/statuses/translations_controller.rb +++ b/app/controllers/api/v1/statuses/translations_controller.rb @@ -1,10 +1,7 @@ # frozen_string_literal: true -class Api::V1::Statuses::TranslationsController < Api::BaseController - include Authorization - +class Api::V1::Statuses::TranslationsController < Api::V1::Statuses::BaseController before_action -> { doorkeeper_authorize! :read, :'read:statuses' } - before_action :set_status before_action :set_translation rescue_from TranslationService::NotConfiguredError, with: :not_found @@ -24,13 +21,6 @@ class Api::V1::Statuses::TranslationsController < Api::BaseController private - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found - end - def set_translation @translation = TranslateStatusService.new.call(@status, content_locale) end From 49ba5a9f94eb2b595f9bb04e29ba4e7e1d99889a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 13 Nov 2023 11:01:24 -0500 Subject: [PATCH 05/15] Use `hash_including` to check `AccountFilter` setup in `admin/accounts` controller spec (#27838) --- .../controllers/admin/accounts_controller_spec.rb | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index ba03ec85a4..3b8fa2f71c 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -20,8 +20,7 @@ RSpec.describe Admin::AccountsController do it 'filters with parameters' do account_filter = instance_double(AccountFilter, results: Account.all) allow(AccountFilter).to receive(:new).and_return(account_filter) - - get :index, params: { + params = { origin: 'local', by_domain: 'domain', status: 'active', @@ -31,17 +30,9 @@ RSpec.describe Admin::AccountsController do ip: '0.0.0.42', } - expect(AccountFilter).to have_received(:new) do |params| - h = params.to_h + get :index, params: params - expect(h[:origin]).to eq 'local' - expect(h[:by_domain]).to eq 'domain' - expect(h[:status]).to eq 'active' - expect(h[:username]).to eq 'username' - expect(h[:display_name]).to eq 'display name' - expect(h[:email]).to eq 'local-part@domain' - expect(h[:ip]).to eq '0.0.0.42' - end + expect(AccountFilter).to have_received(:new).with(hash_including(params)) end it 'paginates accounts' do From bac9e0b55d77257b9b9d8ce602ca79c3885a9d18 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 13 Nov 2023 17:17:05 +0100 Subject: [PATCH 06/15] Add variable delay before link verification of remote account links (#27774) --- app/services/activitypub/process_account_service.rb | 2 +- app/services/update_account_service.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index 1304ca8242..8fc0989a3f 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -180,7 +180,7 @@ class ActivityPub::ProcessAccountService < BaseService end def check_links! - VerifyAccountLinksWorker.perform_async(@account.id) + VerifyAccountLinksWorker.perform_in(rand(10.minutes.to_i), @account.id) end def process_duplicate_accounts! diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index a98f4d31e4..1bbcfce3ea 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -30,11 +30,7 @@ class UpdateAccountService < BaseService def check_links(account) return unless account.fields.any?(&:requires_verification?) - if account.local? - VerifyAccountLinksWorker.perform_async(account.id) - else - VerifyAccountLinksWorker.perform_in(rand(10.minutes.to_i), account.id) - end + VerifyAccountLinksWorker.perform_async(account.id) end def process_hashtags(account) From b7807f3d84983ab46c3345d076576ffa8433dab4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 13 Nov 2023 17:47:44 -0500 Subject: [PATCH 07/15] Use `normalizes` to prepare `Webhook#events` value (#27605) --- app/models/webhook.rb | 16 ++++++++-------- spec/models/webhook_spec.rb | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/app/models/webhook.rb b/app/models/webhook.rb index 044097921e..304b2b1f18 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -33,11 +33,11 @@ class Webhook < ApplicationRecord validates :secret, presence: true, length: { minimum: 12 } validates :events, presence: true - validate :validate_events + validate :events_validation_error, if: :invalid_events? validate :validate_permissions validate :validate_template - before_validation :strip_events + normalizes :events, with: ->(events) { events.filter_map { |event| event.strip.presence } } before_validation :generate_secret def rotate_secret! @@ -69,8 +69,12 @@ class Webhook < ApplicationRecord private - def validate_events - errors.add(:events, :invalid) if events.any? { |e| EVENTS.exclude?(e) } + def events_validation_error + errors.add(:events, :invalid) + end + + def invalid_events? + events.blank? || events.difference(EVENTS).any? end def validate_permissions @@ -88,10 +92,6 @@ class Webhook < ApplicationRecord end end - def strip_events - self.events = events.filter_map { |str| str.strip.presence } if events.present? - end - def generate_secret self.secret = SecureRandom.hex(20) if secret.blank? end diff --git a/spec/models/webhook_spec.rb b/spec/models/webhook_spec.rb index 715dd7574f..effaf92e9c 100644 --- a/spec/models/webhook_spec.rb +++ b/spec/models/webhook_spec.rb @@ -5,6 +5,37 @@ require 'rails_helper' RSpec.describe Webhook do let(:webhook) { Fabricate(:webhook) } + describe 'Validations' do + it 'requires presence of events' do + record = described_class.new(events: nil) + record.valid? + + expect(record).to model_have_error_on_field(:events) + end + + it 'requires non-empty events value' do + record = described_class.new(events: []) + record.valid? + + expect(record).to model_have_error_on_field(:events) + end + + it 'requires valid events value from EVENTS' do + record = described_class.new(events: ['account.invalid']) + record.valid? + + expect(record).to model_have_error_on_field(:events) + end + end + + describe 'Normalizations' do + it 'cleans up events values' do + record = described_class.new(events: ['account.approved', 'account.created ', '']) + + expect(record.events).to eq(%w(account.approved account.created)) + end + end + describe '#rotate_secret!' do it 'changes the secret' do previous_value = webhook.secret From 4aa06cbdbfbd4a4f9508c988c012951024b561e8 Mon Sep 17 00:00:00 2001 From: Brian Holley Date: Mon, 13 Nov 2023 16:39:54 -0800 Subject: [PATCH 08/15] Fix "Hide these posts from home" list setting not refreshing when switching lists (#27763) --- app/javascript/mastodon/features/list_timeline/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/list_timeline/index.jsx b/app/javascript/mastodon/features/list_timeline/index.jsx index aadb6ecd54..55579c2fd1 100644 --- a/app/javascript/mastodon/features/list_timeline/index.jsx +++ b/app/javascript/mastodon/features/list_timeline/index.jsx @@ -204,7 +204,7 @@ class ListTimeline extends PureComponent {
- + From 5e2ecc736ddf275e57c91348a7b0a485f9b2462d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 14 Nov 2023 05:29:33 -0500 Subject: [PATCH 09/15] Remove double `subject` in api/v1/accounts/relationships spec (#27839) --- .../api/v1/accounts/relationships_spec.rb | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/spec/requests/api/v1/accounts/relationships_spec.rb b/spec/requests/api/v1/accounts/relationships_spec.rb index bb78e3b3e4..5011352c6b 100644 --- a/spec/requests/api/v1/accounts/relationships_spec.rb +++ b/spec/requests/api/v1/accounts/relationships_spec.rb @@ -102,17 +102,25 @@ describe 'GET /api/v1/accounts/relationships' do end end - it 'returns JSON with correct data on cached requests too' do - subject - subject + it 'returns JSON with correct data on previously cached requests' do + # Initial request including multiple accounts in params + get '/api/v1/accounts/relationships', headers: headers, params: { id: [simon.id, lewis.id] } + expect(body_as_json.size).to eq(2) + + # Subsequent request with different id, should override cache from first request + get '/api/v1/accounts/relationships', headers: headers, params: { id: [simon.id] } expect(response).to have_http_status(200) - json = body_as_json - - expect(json).to be_a Enumerable - expect(json.first[:following]).to be true - expect(json.first[:showing_reblogs]).to be true + expect(body_as_json) + .to be_an(Enumerable) + .and have_attributes( + size: 1, + first: hash_including( + following: true, + showing_reblogs: true + ) + ) end it 'returns JSON with correct data after change too' do From 373aa95dddd7119725c4f11d3af402066e2288cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:30:39 +0100 Subject: [PATCH 10/15] Update formatjs monorepo (#27849) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 154 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 107 insertions(+), 47 deletions(-) diff --git a/yarn.lock b/yarn.lock index e8fe28fb46..1cb5a42d50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1800,6 +1800,16 @@ __metadata: languageName: node linkType: hard +"@formatjs/ecma402-abstract@npm:1.18.0": + version: 1.18.0 + resolution: "@formatjs/ecma402-abstract@npm:1.18.0" + dependencies: + "@formatjs/intl-localematcher": "npm:0.5.2" + tslib: "npm:^2.4.0" + checksum: bbdad0aee8e48baad6bfe6b2c27caf3befe35e658b922ee2f84417a819f0bdc7e849a8c0c782db8b53f5666bf19669d2b10a1104257c08796d198c87766bfc92 + languageName: node + linkType: hard + "@formatjs/fast-memoize@npm:2.2.0": version: 2.2.0 resolution: "@formatjs/fast-memoize@npm:2.2.0" @@ -1820,6 +1830,17 @@ __metadata: languageName: node linkType: hard +"@formatjs/icu-messageformat-parser@npm:2.7.3": + version: 2.7.3 + resolution: "@formatjs/icu-messageformat-parser@npm:2.7.3" + dependencies: + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/icu-skeleton-parser": "npm:1.7.0" + tslib: "npm:^2.4.0" + checksum: 2a51038813e5cff7e2df767e1227373d228e907adb7268fc3744b3d82c4fa69d4aa9f6020a62de2c468cf724600e9372ac07ae43a4480ed066fe34e224e80e4a + languageName: node + linkType: hard + "@formatjs/icu-skeleton-parser@npm:1.6.4": version: 1.6.4 resolution: "@formatjs/icu-skeleton-parser@npm:1.6.4" @@ -1830,25 +1851,35 @@ __metadata: languageName: node linkType: hard -"@formatjs/intl-displaynames@npm:6.6.3": - version: 6.6.3 - resolution: "@formatjs/intl-displaynames@npm:6.6.3" +"@formatjs/icu-skeleton-parser@npm:1.7.0": + version: 1.7.0 + resolution: "@formatjs/icu-skeleton-parser@npm:1.7.0" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" - "@formatjs/intl-localematcher": "npm:0.5.1" + "@formatjs/ecma402-abstract": "npm:1.18.0" tslib: "npm:^2.4.0" - checksum: b0520cb744a51290fbcde80860f39ed9c9df9b81beae98986e1fc089ef635f7699c750631fa42a559f3678d1dd02b14904614e70360477d18e68d3eba6592390 + checksum: 2e4db815247ddb10f7990bbb501c85b854ee951ee45143673eb91b4392b11d0a8312327adb8b624c6a2fdafab12083904630d6d22475503d025f1612da4dcaee languageName: node linkType: hard -"@formatjs/intl-listformat@npm:7.5.2": - version: 7.5.2 - resolution: "@formatjs/intl-listformat@npm:7.5.2" +"@formatjs/intl-displaynames@npm:6.6.4": + version: 6.6.4 + resolution: "@formatjs/intl-displaynames@npm:6.6.4" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" - "@formatjs/intl-localematcher": "npm:0.5.1" + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/intl-localematcher": "npm:0.5.2" tslib: "npm:^2.4.0" - checksum: 54fa03da4ea45504681d6d87d72d1cac574809ce43f965fa4b845e83be3072d92324c58cec57ad386827087fb1d6ecae438d29576f30176bf52eb212e454bce2 + checksum: 009e443dd0d10776b8573d0181407d4c0d6c7a2ff537a5ea1e36413d1b08db9c21dfef272eabab8efabd01a58b64f663a30e4d584fd761df3fd68a5d23fe444b + languageName: node + linkType: hard + +"@formatjs/intl-listformat@npm:7.5.3": + version: 7.5.3 + resolution: "@formatjs/intl-listformat@npm:7.5.3" + dependencies: + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/intl-localematcher": "npm:0.5.2" + tslib: "npm:^2.4.0" + checksum: de741ce84b16fed57016afbfe446ebd57cd23a046859a9353f5d455f8bc9114493bf83b9e18429268c7ce8f77bc54516a9b8190baf09fbb25c9b06cfc80101d4 languageName: node linkType: hard @@ -1861,34 +1892,43 @@ __metadata: languageName: node linkType: hard -"@formatjs/intl-pluralrules@npm:^5.2.2": - version: 5.2.9 - resolution: "@formatjs/intl-pluralrules@npm:5.2.9" +"@formatjs/intl-localematcher@npm:0.5.2": + version: 0.5.2 + resolution: "@formatjs/intl-localematcher@npm:0.5.2" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" - "@formatjs/intl-localematcher": "npm:0.5.1" tslib: "npm:^2.4.0" - checksum: a6ca5c498ce542facacf8ce8640d4ba068f9119b758547a23614b50611eb385a46abd386ff88fa423211355ec463cf102c2c908b74f6e23a5bc9e2a23873dc29 + checksum: 4b3ae75470e3e53ffa39b2d46e65a2a4c9c4becbc0aac989b0694370e10c6687643660a045512d676509bc29b257fe5726fbb028de12f889be02c2d20b6527e6 languageName: node linkType: hard -"@formatjs/intl@npm:2.9.8": - version: 2.9.8 - resolution: "@formatjs/intl@npm:2.9.8" +"@formatjs/intl-pluralrules@npm:^5.2.2": + version: 5.2.10 + resolution: "@formatjs/intl-pluralrules@npm:5.2.10" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/intl-localematcher": "npm:0.5.2" + tslib: "npm:^2.4.0" + checksum: 1050416613e80bff2c58546c80c8d52ed97847d13c90535a53d058e44969369b50e1cfdb464e9e9ef4802c934c84ea0e656c3f4e3b4d5ac7496b722c759da4cf + languageName: node + linkType: hard + +"@formatjs/intl@npm:2.9.9": + version: 2.9.9 + resolution: "@formatjs/intl@npm:2.9.9" + dependencies: + "@formatjs/ecma402-abstract": "npm:1.18.0" "@formatjs/fast-memoize": "npm:2.2.0" - "@formatjs/icu-messageformat-parser": "npm:2.7.2" - "@formatjs/intl-displaynames": "npm:6.6.3" - "@formatjs/intl-listformat": "npm:7.5.2" - intl-messageformat: "npm:10.5.7" + "@formatjs/icu-messageformat-parser": "npm:2.7.3" + "@formatjs/intl-displaynames": "npm:6.6.4" + "@formatjs/intl-listformat": "npm:7.5.3" + intl-messageformat: "npm:10.5.8" tslib: "npm:^2.4.0" peerDependencies: typescript: 5 peerDependenciesMeta: typescript: optional: true - checksum: 6341f4bfb56a0e14373395b1232e1eeb8e64588a8c3d4614cd2b06f71d4e65dbd4a79e3a1c07e1b6c20c48e399ac2385977b01a559e1d2bd1a1d226e0eae3058 + checksum: b26904da605ab309535dfbbfbd403a3bb33d51d3c969c548b88fa04755be3aff60b1bddd1c453514a84048c7432271cef507ac66de32dcfa66b3f842a1ddb977 languageName: node linkType: hard @@ -1912,6 +1952,26 @@ __metadata: languageName: node linkType: hard +"@formatjs/ts-transformer@npm:3.13.9": + version: 3.13.9 + resolution: "@formatjs/ts-transformer@npm:3.13.9" + dependencies: + "@formatjs/icu-messageformat-parser": "npm:2.7.3" + "@types/json-stable-stringify": "npm:^1.0.32" + "@types/node": "npm:14 || 16 || 17" + chalk: "npm:^4.0.0" + json-stable-stringify: "npm:^1.0.1" + tslib: "npm:^2.4.0" + typescript: "npm:5" + peerDependencies: + ts-jest: ">=27" + peerDependenciesMeta: + ts-jest: + optional: true + checksum: 4e313b967e45aae79246174c3181d31cc7cd297380d3a880a98fc0be16d76b783868712151e840ea16d22e2fbec0388b1005f688b6d4cb74ee4411b43f6d33f4 + languageName: node + linkType: hard + "@gamestdio/websocket@npm:^0.3.2": version: 0.3.2 resolution: "@gamestdio/websocket@npm:0.3.2" @@ -4675,21 +4735,21 @@ __metadata: linkType: hard "babel-plugin-formatjs@npm:^10.5.1": - version: 10.5.9 - resolution: "babel-plugin-formatjs@npm:10.5.9" + version: 10.5.10 + resolution: "babel-plugin-formatjs@npm:10.5.10" dependencies: "@babel/core": "npm:^7.10.4" "@babel/helper-plugin-utils": "npm:^7.10.4" "@babel/plugin-syntax-jsx": "npm:7" "@babel/traverse": "npm:7" "@babel/types": "npm:^7.12.11" - "@formatjs/icu-messageformat-parser": "npm:2.7.2" - "@formatjs/ts-transformer": "npm:3.13.8" + "@formatjs/icu-messageformat-parser": "npm:2.7.3" + "@formatjs/ts-transformer": "npm:3.13.9" "@types/babel__core": "npm:^7.1.7" "@types/babel__helper-plugin-utils": "npm:^7.10.0" "@types/babel__traverse": "npm:^7.1.7" tslib: "npm:^2.4.0" - checksum: 5e4127cf7b4b9b3306a9d0ab5b029831712d22db5e2117225ce706b55d222d09a7eba1f3720fdad7a99f61843b5cba107296fc11ae00a6f0941217d9322aa02e + checksum: bff65cd2a88a0ae00eabab1d022ffc44c4385b7e529cac42375bb1828c678c7a71a78f644512e5d1dd8cd532d418c16acdbabcef2bf6670e24404f4f164a74ce languageName: node linkType: hard @@ -9243,15 +9303,15 @@ __metadata: languageName: node linkType: hard -"intl-messageformat@npm:10.5.7, intl-messageformat@npm:^10.3.5": - version: 10.5.7 - resolution: "intl-messageformat@npm:10.5.7" +"intl-messageformat@npm:10.5.8, intl-messageformat@npm:^10.3.5": + version: 10.5.8 + resolution: "intl-messageformat@npm:10.5.8" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" + "@formatjs/ecma402-abstract": "npm:1.18.0" "@formatjs/fast-memoize": "npm:2.2.0" - "@formatjs/icu-messageformat-parser": "npm:2.7.2" + "@formatjs/icu-messageformat-parser": "npm:2.7.3" tslib: "npm:^2.4.0" - checksum: 7f341b3eb5b3d402167c99ca7fb98720c7ad553bed8a490b2210bd90ea9009a09f9030939307fecb111fce1454f31b4298b4f0a346999af627c86f8164a5c547 + checksum: 1d2854aae8471ec48165ca265760d6c5b1814eca831c88db698eb29b5ed20bee21ca8533090c9d28d9c6f1d844dda210b0bc58a2e036446158fae0845e5eed4f languageName: node linkType: hard @@ -13643,18 +13703,18 @@ __metadata: linkType: hard "react-intl@npm:^6.4.2": - version: 6.5.4 - resolution: "react-intl@npm:6.5.4" + version: 6.5.5 + resolution: "react-intl@npm:6.5.5" dependencies: - "@formatjs/ecma402-abstract": "npm:1.17.4" - "@formatjs/icu-messageformat-parser": "npm:2.7.2" - "@formatjs/intl": "npm:2.9.8" - "@formatjs/intl-displaynames": "npm:6.6.3" - "@formatjs/intl-listformat": "npm:7.5.2" + "@formatjs/ecma402-abstract": "npm:1.18.0" + "@formatjs/icu-messageformat-parser": "npm:2.7.3" + "@formatjs/intl": "npm:2.9.9" + "@formatjs/intl-displaynames": "npm:6.6.4" + "@formatjs/intl-listformat": "npm:7.5.3" "@types/hoist-non-react-statics": "npm:^3.3.1" "@types/react": "npm:16 || 17 || 18" hoist-non-react-statics: "npm:^3.3.2" - intl-messageformat: "npm:10.5.7" + intl-messageformat: "npm:10.5.8" tslib: "npm:^2.4.0" peerDependencies: react: ^16.6.0 || 17 || 18 @@ -13662,7 +13722,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 1117a7f866b103abf88a4087f5fe8b854d9c069c69444c592f8431e7d28c9b90423f7b50e550be0f2f173b7563e943bcc9238e80f6747181f81861275f6e2ce7 + checksum: 9ff6200f195557804b735d618ee593aed7848e84213ac4eb9c57708f55c0d93232e0dd338c990348ba3b1d73dca071502a2051d4a2790838d962c3ccde87fa6c languageName: node linkType: hard From 1f8173ac5aa2dbdab66e6c426b137f4fcc162462 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 14 Nov 2023 05:31:59 -0500 Subject: [PATCH 11/15] Extract private methods in api/v1/instances/domain_blocks (#27844) --- .../api/v1/instances/domain_blocks_controller.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/instances/domain_blocks_controller.rb b/app/controllers/api/v1/instances/domain_blocks_controller.rb index 566764dbf0..8fb90305ad 100644 --- a/app/controllers/api/v1/instances/domain_blocks_controller.rb +++ b/app/controllers/api/v1/instances/domain_blocks_controller.rb @@ -13,7 +13,7 @@ class Api::V1::Instances::DomainBlocksController < Api::V1::Instances::BaseContr cache_if_unauthenticated! end - render json: @domain_blocks, each_serializer: REST::DomainBlockSerializer, with_comment: (Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?)) + render json: @domain_blocks, each_serializer: REST::DomainBlockSerializer, with_comment: show_rationale_in_response? end private @@ -25,4 +25,16 @@ class Api::V1::Instances::DomainBlocksController < Api::V1::Instances::BaseContr def set_domain_blocks @domain_blocks = DomainBlock.with_user_facing_limitations.by_severity end + + def show_rationale_in_response? + always_show_rationale? || show_rationale_for_user? + end + + def always_show_rationale? + Setting.show_domain_blocks_rationale == 'all' + end + + def show_rationale_for_user? + Setting.show_domain_blocks_rationale == 'users' && user_signed_in? + end end From c1e071f6343a0b5c6383e6a336fd1aaf8dc97100 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:53:47 +0100 Subject: [PATCH 12/15] New Crowdin Translations (automated) (#27848) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/af.json | 4 ++++ app/javascript/mastodon/locales/be.json | 6 +++--- app/javascript/mastodon/locales/ca.json | 1 + app/javascript/mastodon/locales/fy.json | 1 + app/javascript/mastodon/locales/lt.json | 9 ++++++++- app/javascript/mastodon/locales/sl.json | 1 + app/javascript/mastodon/locales/sr-Latn.json | 1 + app/javascript/mastodon/locales/sr.json | 1 + config/locales/activerecord.af.yml | 4 ++++ config/locales/af.yml | 17 +++++++++++++++++ config/locales/be.yml | 1 + config/locales/ca.yml | 1 + config/locales/cy.yml | 1 + config/locales/da.yml | 5 +++++ config/locales/de.yml | 1 + config/locales/devise.be.yml | 2 +- config/locales/doorkeeper.af.yml | 1 + config/locales/es-AR.yml | 1 + config/locales/es-MX.yml | 1 + config/locales/es.yml | 1 + config/locales/eu.yml | 1 + config/locales/fa.yml | 1 + config/locales/fo.yml | 1 + config/locales/fr-QC.yml | 1 + config/locales/fr.yml | 1 + config/locales/fy.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 5 +++-- config/locales/hu.yml | 1 + config/locales/is.yml | 1 + config/locales/it.yml | 1 + config/locales/ko.yml | 1 + config/locales/lt.yml | 1 + config/locales/nl.yml | 1 + config/locales/nn.yml | 1 + config/locales/no.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt-PT.yml | 1 + config/locales/simple_form.be.yml | 2 +- config/locales/sk.yml | 8 ++++++++ config/locales/sl.yml | 1 + config/locales/sq.yml | 1 + config/locales/sr-Latn.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/zh-CN.yml | 1 + config/locales/zh-HK.yml | 1 + config/locales/zh-TW.yml | 1 + 52 files changed, 96 insertions(+), 8 deletions(-) diff --git a/app/javascript/mastodon/locales/af.json b/app/javascript/mastodon/locales/af.json index 7e842b5dd4..6f7f355fc4 100644 --- a/app/javascript/mastodon/locales/af.json +++ b/app/javascript/mastodon/locales/af.json @@ -14,6 +14,7 @@ "account.badges.group": "Groep", "account.block": "Blokkeer @{name}", "account.block_domain": "Blokkeer domein {domain}", + "account.block_short": "Blokkeer", "account.blocked": "Geblokkeer", "account.browse_more_on_origin_server": "Verken die oorspronklike profiel", "account.cancel_follow_request": "Herroep volgversoek", @@ -45,6 +46,7 @@ "account.posts_with_replies": "Plasings en antwoorde", "account.report": "Rapporteer @{name}", "account.requested": "Wag op goedkeuring. Klik om volgversoek te kanselleer", + "account.requested_follow": "{name} het versoek om jou te volg", "account.share": "Deel @{name} se profiel", "account.show_reblogs": "Wys aangestuurde plasings van @{name}", "account.statuses_counter": "{count, plural, one {{counter} Plaas} other {{counter} Plasings}}", @@ -82,6 +84,7 @@ "column.community": "Plaaslike tydlyn", "column.directory": "Blaai deur profiele", "column.domain_blocks": "Geblokkeerde domeine", + "column.favourites": "Gunstelinge", "column.follow_requests": "Volgversoeke", "column.home": "Tuis", "column.lists": "Lyste", @@ -271,6 +274,7 @@ "privacy.unlisted.short": "Ongelys", "privacy_policy.last_updated": "Laaste bywerking op {date}", "privacy_policy.title": "Privaatheidsbeleid", + "regeneration_indicator.sublabel": "Jou tuis-voer word voorberei!", "reply_indicator.cancel": "Kanselleer", "report.placeholder": "Type or paste additional comments", "report.submit": "Submit report", diff --git a/app/javascript/mastodon/locales/be.json b/app/javascript/mastodon/locales/be.json index 7c2d652b61..e8a52ee29c 100644 --- a/app/javascript/mastodon/locales/be.json +++ b/app/javascript/mastodon/locales/be.json @@ -201,7 +201,7 @@ "disabled_account_banner.text": "Ваш уліковы запіс {disabledAccount} часова адключаны.", "dismissable_banner.community_timeline": "Гэта самыя апошнія допісы ад людзей, уліковыя запісы якіх размяшчаюцца на {domain}.", "dismissable_banner.dismiss": "Адхіліць", - "dismissable_banner.explore_links": "Гэтыя навіны абмяркоўваюцца прама зараз на гэтым і іншых серверах дэцэнтралізаванай сеткі.", + "dismissable_banner.explore_links": "Гэтыя навіны абмяркоўваюцца цяпер на гэтым і іншых серверах дэцэнтралізаванай сеткі.", "dismissable_banner.explore_statuses": "Допісы з гэтага і іншых сервераў дэцэнтралізаванай сеткі, якія набіраюць папулярнасць прама зараз.", "dismissable_banner.explore_tags": "Гэтыя хэштэгі зараз набіраюць папулярнасць сярод людзей на гэтым і іншых серверах дэцэнтралізаванай сеткі", "dismissable_banner.public_timeline": "Гэта апошнія публічныя допісы людзей з усей сеткі, за якімі сочаць карыстальнікі {domain}.", @@ -482,7 +482,7 @@ "onboarding.share.lead": "Дайце людзям ведаць, як яны могуць знайсці вас на Mastodon!", "onboarding.share.message": "Я {username} на #Mastodon! Сачыце за мной на {url}", "onboarding.share.next_steps": "Магчымыя наступныя крокі:", - "onboarding.share.title": "Падзяліцеся сваім профілем", + "onboarding.share.title": "Абагульце свой профіль", "onboarding.start.lead": "Your new Mastodon account is ready to go. Here's how you can make the most of it:", "onboarding.start.skip": "Want to skip right ahead?", "onboarding.start.title": "Вы зрабілі гэта!", @@ -493,7 +493,7 @@ "onboarding.steps.setup_profile.body": "Others are more likely to interact with you with a filled out profile.", "onboarding.steps.setup_profile.title": "Customize your profile", "onboarding.steps.share_profile.body": "Let your friends know how to find you on Mastodon!", - "onboarding.steps.share_profile.title": "Share your profile", + "onboarding.steps.share_profile.title": "Абагульць ваш профіль у Mastodon", "onboarding.tips.2fa": "Ці вы ведаеце? Вы можаце абараніць свой уліковы запіс, усталяваўшы двухфактарную аўтэнтыфікацыю ў наладах уліковага запісу. Яна працуе з любой праграмай TOTP на ваш выбар, нумар тэлефона не патрэбны!", "onboarding.tips.accounts_from_other_servers": "Ці вы ведаеце? Паколькі Mastodon дэцэнтралізаваны, некаторыя профілі, якія вам трапляюцца, будуць размяшчацца на іншых серверах, адрозных ад вашага. І ўсё ж вы можаце бесперашкодна ўзаемадзейнічаць з імі! Іх сервер пазначаны ў другой палове імя карыстальніка!", "onboarding.tips.migration": "Ці вы ведаеце? Калі вы адчуваеце, што {domain} не з'яўляецца для вас лепшым выбарам у будучыні, вы можаце перайсці на іншы сервер Mastodon, не губляючы сваіх падпісчыкаў. Вы нават можаце стварыць свой уласны сервер!", diff --git a/app/javascript/mastodon/locales/ca.json b/app/javascript/mastodon/locales/ca.json index 433b9b47b7..99cae584b0 100644 --- a/app/javascript/mastodon/locales/ca.json +++ b/app/javascript/mastodon/locales/ca.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Resultats de la cerca", "emoji_button.symbols": "Símbols", "emoji_button.travel": "Viatges i llocs", + "empty_column.account_hides_collections": "Aquest usuari ha elegit no mostrar aquesta informació", "empty_column.account_suspended": "Compte suspès", "empty_column.account_timeline": "No hi ha tuts aquí!", "empty_column.account_unavailable": "Perfil no disponible", diff --git a/app/javascript/mastodon/locales/fy.json b/app/javascript/mastodon/locales/fy.json index 12365c879d..9d3b416068 100644 --- a/app/javascript/mastodon/locales/fy.json +++ b/app/javascript/mastodon/locales/fy.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Sykresultaten", "emoji_button.symbols": "Symboalen", "emoji_button.travel": "Reizgje en lokaasjes", + "empty_column.account_hides_collections": "Dizze brûker hat derfoar keazen dizze ynformaasje net beskikber te meitsjen", "empty_column.account_suspended": "Account beskoattele", "empty_column.account_timeline": "Hjir binne gjin berjochten!", "empty_column.account_unavailable": "Profyl net beskikber", diff --git a/app/javascript/mastodon/locales/lt.json b/app/javascript/mastodon/locales/lt.json index 75f4a239e7..5cdc575dee 100644 --- a/app/javascript/mastodon/locales/lt.json +++ b/app/javascript/mastodon/locales/lt.json @@ -41,6 +41,8 @@ "account.languages": "Keisti prenumeruojamas kalbas", "account.locked_info": "Šios paskyros privatumo būsena nustatyta kaip užrakinta. Savininkas (-ė) rankiniu būdu peržiūri, kas gali sekti.", "account.media": "Medija", + "account.mention": "Paminėti @{name}", + "account.moved_to": "{name} nurodė, kad dabar jų nauja paskyra yra:", "account.mute": "Užtildyti @{name}", "account.muted": "Užtildytas", "account.posts": "Toots", @@ -53,10 +55,15 @@ "account.unfollow": "Nebesekti", "account.unmute_short": "Atitildyti", "account_note.placeholder": "Click to add a note", - "alert.unexpected.title": "Oi!", + "alert.unexpected.message": "Įvyko netikėta klaida.", + "alert.unexpected.title": "Ups!", "announcement.announcement": "Skelbimas", + "attachments_list.unprocessed": "(neapdorotas)", "audio.hide": "Slėpti garsą", "autosuggest_hashtag.per_week": "{count} per savaitę", + "boost_modal.combo": "Gali spausti {combo}, kad praleisti kitą kartą", + "bundle_column_error.copy_stacktrace": "Kopijuoti klaidos ataskaitą", + "bundle_column_error.error.body": "Užklausos puslapio nepavyko atvaizduoti. Tai gali būti dėl mūsų kodo klaidos arba naršyklės suderinamumo problemos.", "bundle_column_error.error.title": "O, ne!", "column.domain_blocks": "Hidden domains", "column.lists": "Sąrašai", diff --git a/app/javascript/mastodon/locales/sl.json b/app/javascript/mastodon/locales/sl.json index 63507be791..f16a91d65a 100644 --- a/app/javascript/mastodon/locales/sl.json +++ b/app/javascript/mastodon/locales/sl.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Rezultati iskanja", "emoji_button.symbols": "Simboli", "emoji_button.travel": "Potovanja in kraji", + "empty_column.account_hides_collections": "Ta uporabnik se je odločil, da te informacije ne bo dal na voljo", "empty_column.account_suspended": "Račun je suspendiran", "empty_column.account_timeline": "Tukaj ni objav!", "empty_column.account_unavailable": "Profil ni na voljo", diff --git a/app/javascript/mastodon/locales/sr-Latn.json b/app/javascript/mastodon/locales/sr-Latn.json index f64952f7b5..aa948b1f0e 100644 --- a/app/javascript/mastodon/locales/sr-Latn.json +++ b/app/javascript/mastodon/locales/sr-Latn.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Rezultati pretrage", "emoji_button.symbols": "Simboli", "emoji_button.travel": "Putovanja i mesta", + "empty_column.account_hides_collections": "Ovaj korisnik je odlučio da ove informacije ne učini dostupnim", "empty_column.account_suspended": "Nalog je suspendovan", "empty_column.account_timeline": "Nema objava ovde!", "empty_column.account_unavailable": "Profil je nedostupan", diff --git a/app/javascript/mastodon/locales/sr.json b/app/javascript/mastodon/locales/sr.json index ec2c76e8f9..9e67169272 100644 --- a/app/javascript/mastodon/locales/sr.json +++ b/app/javascript/mastodon/locales/sr.json @@ -222,6 +222,7 @@ "emoji_button.search_results": "Резултати претраге", "emoji_button.symbols": "Симболи", "emoji_button.travel": "Путовања и места", + "empty_column.account_hides_collections": "Овај корисник је одлучио да ове информације не учини доступним", "empty_column.account_suspended": "Налог је суспендован", "empty_column.account_timeline": "Нема објава овде!", "empty_column.account_unavailable": "Профил је недоступан", diff --git a/config/locales/activerecord.af.yml b/config/locales/activerecord.af.yml index c0810999d8..91980644ed 100644 --- a/config/locales/activerecord.af.yml +++ b/config/locales/activerecord.af.yml @@ -53,3 +53,7 @@ af: position: elevated: kan nie hoër as jou huidige rol wees nie own_role: kan nie verander word met jou huidige rol nie + webhook: + attributes: + events: + invalid_permissions: geleenthede waartoe jy nie toegang het nie mag nie ingesluit word nie diff --git a/config/locales/af.yml b/config/locales/af.yml index 1dbf99afe9..74d3495914 100644 --- a/config/locales/af.yml +++ b/config/locales/af.yml @@ -5,7 +5,23 @@ af: contact_unavailable: NVT hosted_on: Mastodon gehuisves op %{domain} title: Aangaande + accounts: + follow: Volg + followers: + one: Volgeling + other: Volgelinge + following: Volg + nothing_here: Daar is niks hier nie! + posts: + one: Plasing + other: Plasings + posts_tab_heading: Plasings admin: + account_actions: + action: Voer aksie uit + title: Voer modereer aksie uit op %{acct} + account_moderation_notes: + create: Los nota accounts: location: local: Plaaslik @@ -102,6 +118,7 @@ af: types: bookmarks: Boekmerke invites: + invalid: Hierdie uitnodiging is nie geldig nie title: Nooi ander login_activities: description_html: Indien jy onbekende aktiwiteite gewaar, oorweeg dit om jou wagwoord te verander en tweefaktorverifikasie te aktiveer. diff --git a/config/locales/be.yml b/config/locales/be.yml index 275ef7a82c..96a2720126 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -1418,6 +1418,7 @@ be: '86400': 1 дзень expires_in_prompt: Ніколі generate: Стварыць запрашальную спасылку + invalid: Гэта запрашэнне несапраўднае invited_by: 'Вас запрасіў(-ла):' max_uses: few: "%{count} выкарыстанні" diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 2cdf87d8fd..03b3ff3c23 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1358,6 +1358,7 @@ ca: '86400': 1 dia expires_in_prompt: Mai generate: Genera + invalid: Aquesta invitació no és vàlida invited_by: 'Has estat invitat per:' max_uses: one: 1 ús diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 846ce41def..c9d5b88284 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -1468,6 +1468,7 @@ cy: '86400': 1 diwrnod expires_in_prompt: Byth generate: Cynhyrchu dolen wahoddiad + invalid: Nid yw'r gwahoddiad hwn yn ddilys invited_by: 'Cawsoch eich gwahodd gan:' max_uses: few: "%{count} defnydd" diff --git a/config/locales/da.yml b/config/locales/da.yml index c5d6391853..13010e1adf 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1110,6 +1110,7 @@ da: functional: Din konto er fuldt funktionel. pending: Din ansøgning afventer gennemgang af vores medarbejdere. Dette kan tage noget tid. Du modtager en e-mail, hvis din ansøgning godkendes. redirecting_to: Din konto er inaktiv, da den pt. er omdirigerer til %{acct}. + self_destruct: Da %{domain} er under nedlukning, vil kontoadgangen være begrænset. view_strikes: Se tidligere anmeldelser af din konto too_fast: Formularen indsendt for hurtigt, forsøg igen. use_security_key: Brug sikkerhedsnøgle @@ -1367,6 +1368,7 @@ da: '86400': 1 dag expires_in_prompt: Aldrig generate: Generér invitationslink + invalid: Denne invitation er ikke gyldig invited_by: 'Du blev inviteret af:' max_uses: one: 1 benyttelse @@ -1579,6 +1581,9 @@ da: over_daily_limit: Den daglige grænse på %{limit} planlagte indlæg er nået over_total_limit: Grænsen på %{limit} planlagte indlæg er nået too_soon: Den planlagte dato skal være i fremtiden + self_destruct: + lead_html: Desværre lukker %{domain} permanent. Har man en konto dér, vil fortsat brug heraf ikke være mulig. Man kan dog stadig anmode om en sikkerhedskopi af sine data. + title: Denne server er under nedlukning sessions: activity: Seneste aktivitet browser: Browser diff --git a/config/locales/de.yml b/config/locales/de.yml index 2ab90611fb..81fa4b57f3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1368,6 +1368,7 @@ de: '86400': 1 Tag expires_in_prompt: Nie generate: Einladungslink erstellen + invalid: Diese Einladung ist ungültig invited_by: 'Du wurdest eingeladen von:' max_uses: one: Eine Verwendung diff --git a/config/locales/devise.be.yml b/config/locales/devise.be.yml index 3bf35daeda..e5e8aea91e 100644 --- a/config/locales/devise.be.yml +++ b/config/locales/devise.be.yml @@ -18,7 +18,7 @@ be: unconfirmed: Вы павінны пацвердзіць свой адрас электроннай пошты, перш чым працягнуць mailer: confirmation_instructions: - action: Пацвердзіце адрас электроннай пошты + action: Пацвердзіць адрас электроннай пошты action_with_app: Пацвердзіць і вярнуцца да %{app} explanation: Вы стварылі ўліковы запіс на %{host} з гэтым адрасам электроннай пошты. Вам спатрэбіцца ўсяго адзін клік, каб пацвердзіць яго. Калі гэта былі не вы, то проста праігнаруйце гэты ліст. explanation_when_pending: Вы падалі заяўку на запрашэнне на %{host} з гэтым адрасам электроннай пошты. Як толькі вы пацвердзіце свой адрас электроннай пошты, мы разгледзім вашу заяўку. Вы можаце ўвайсці, каб змяніць свае дадзеныя або выдаліць свой уліковы запіс, але вы не можаце атрымаць доступ да большасці функцый, пакуль ваш уліковы запіс не будзе зацверджаны. Калі ваша заяўка будзе адхілена, вашы даныя будуць выдалены, таму ад вас не спатрэбіцца ніякіх дадатковых дзеянняў. Калі гэта былі не вы, ігнаруйце гэты ліст diff --git a/config/locales/doorkeeper.af.yml b/config/locales/doorkeeper.af.yml index 504c7f507e..9e05f403f6 100644 --- a/config/locales/doorkeeper.af.yml +++ b/config/locales/doorkeeper.af.yml @@ -149,6 +149,7 @@ af: write:blocks: blokkeer rekeninge en domeine write:bookmarks: laat ’n boekmerk by plasings write:conversations: doof en wis gesprekke uit + write:favourites: gunsteling plasings write:filters: skep filters write:follows: volg mense write:lists: skep lyste diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 127f1262a3..9175a1fc1a 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -1368,6 +1368,7 @@ es-AR: '86400': 1 día expires_in_prompt: Nunca generate: Generar enlace de invitación + invalid: Esta invitación no es válida invited_by: 'Fuiste invitado por:' max_uses: one: 1 uso diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index ad2fb184ea..75d329b0ae 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -1368,6 +1368,7 @@ es-MX: '86400': 1 día expires_in_prompt: Nunca generate: Generar + invalid: Esta invitación no es válida invited_by: 'Fuiste invitado por:' max_uses: one: 1 uso diff --git a/config/locales/es.yml b/config/locales/es.yml index d071e19a12..34d1c85dc0 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1368,6 +1368,7 @@ es: '86400': 1 día expires_in_prompt: Nunca generate: Generar + invalid: Esta invitación no es válida invited_by: 'Fuiste invitado por:' max_uses: one: 1 uso diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 3b7bba6ce3..dd7575c57a 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1363,6 +1363,7 @@ eu: '86400': Egun 1 expires_in_prompt: Inoiz ez generate: Sortu + invalid: Gonbidapen hau ez da baliozkoa invited_by: 'Honek gonbidatu zaitu:' max_uses: one: Erabilera 1 diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 8569d2e371..04fb52e757 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -1157,6 +1157,7 @@ fa: '86400': ۱ روز expires_in_prompt: هیچ وقت generate: ساختن + invalid: این دعوت‌نامه معتبر نیست invited_by: 'دعوت‌کنندهٔ شما:' max_uses: one: ۱ بار diff --git a/config/locales/fo.yml b/config/locales/fo.yml index 8e98cc8649..ffa54f588e 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -1368,6 +1368,7 @@ fo: '86400': 1 dag expires_in_prompt: Ongantíð generate: Ger innbjóðingarleinki + invalid: Henda innbjóðing er ikki gildug invited_by: 'Tú var bjóðað/ur av:' max_uses: one: 1 brúk diff --git a/config/locales/fr-QC.yml b/config/locales/fr-QC.yml index 41b71f569d..f7425ea320 100644 --- a/config/locales/fr-QC.yml +++ b/config/locales/fr-QC.yml @@ -1368,6 +1368,7 @@ fr-QC: '86400': 1 jour expires_in_prompt: Jamais generate: Générer un lien d'invitation + invalid: Cette invitation n’est pas valide invited_by: 'Vous avez été invité·e par :' max_uses: one: 1 utilisation diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 79d8b92c2a..289afb2268 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1368,6 +1368,7 @@ fr: '86400': 1 jour expires_in_prompt: Jamais generate: Générer un lien d'invitation + invalid: Cette invitation n’est pas valide invited_by: 'Vous avez été invité·e par :' max_uses: one: 1 utilisation diff --git a/config/locales/fy.yml b/config/locales/fy.yml index 011899d15d..de609a14dd 100644 --- a/config/locales/fy.yml +++ b/config/locales/fy.yml @@ -1368,6 +1368,7 @@ fy: '86400': 1 dei expires_in_prompt: Nea generate: Utnûgingskeppeling generearje + invalid: Dizze útnûging is net jildich invited_by: 'Jo binne útnûge troch:' max_uses: one: 1 kear diff --git a/config/locales/gl.yml b/config/locales/gl.yml index f86b4fc20b..0075c65920 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1368,6 +1368,7 @@ gl: '86400': 1 día expires_in_prompt: Nunca generate: Xerar + invalid: Este convite non é válido invited_by: 'Convidoute:' max_uses: one: 1 uso diff --git a/config/locales/he.yml b/config/locales/he.yml index ea2ab8f29a..11e5db4539 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -113,8 +113,8 @@ he: previous_strikes_description_html: many: לחשבון הזה יש %{count} פסילות. one: לחשבון הזה פסילה אחת. - other: לחשבון הזה %{count} פסילות. - two: לחשבון הזה %{count} פסילות. + other: לחשבון הזה יש %{count} פסילות. + two: לחשבון הזה יש שתי פסילות. promote: להעלות בדרגה protocol: פרטיכל public: פומבי @@ -1418,6 +1418,7 @@ he: '86400': יום אחד expires_in_prompt: לעולם לא generate: יצירת קישור להזמנה + invalid: הזמנה זו אינה תקפה invited_by: הוזמנת ע"י max_uses: many: "%{count} שימושים" diff --git a/config/locales/hu.yml b/config/locales/hu.yml index c01f38a9a9..48f9d5b9d1 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1368,6 +1368,7 @@ hu: '86400': 1 nap expires_in_prompt: Soha generate: Generálás + invalid: Ez a meghívó nem érvényes invited_by: 'Téged meghívott:' max_uses: one: 1 használat diff --git a/config/locales/is.yml b/config/locales/is.yml index e0eb955699..390ce0ac03 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -1372,6 +1372,7 @@ is: '86400': 1 dagur expires_in_prompt: Aldrei generate: Útbúa boðstengil + invalid: Þetta boð er ekki gilt invited_by: 'Þér var boðið af:' max_uses: one: 1 afnot diff --git a/config/locales/it.yml b/config/locales/it.yml index e62ea620c9..f35e9e42b1 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1370,6 +1370,7 @@ it: '86400': 1 giorno expires_in_prompt: Mai generate: Genera + invalid: Questo invito non è valido invited_by: 'Sei stato invitato da:' max_uses: one: un uso diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 72eafc8fb8..fb193c75f6 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1345,6 +1345,7 @@ ko: '86400': 1 일 expires_in_prompt: 영원히 generate: 초대 링크 생성하기 + invalid: 이 초대는 올바르지 않습니다 invited_by: '당신을 초대한 사람:' max_uses: other: "%{count}회" diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 2f4d813c9e..529eb5a44c 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -383,6 +383,7 @@ lt: '86400': 1 dienos expires_in_prompt: Niekada generate: Generuoti + invalid: Šis kvietimas negalioja. invited_by: 'Jus pakvietė:' max_uses: few: "%{count} panaudojimai" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 2a8a59d764..94a1f29f7f 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1368,6 +1368,7 @@ nl: '86400': 1 dag expires_in_prompt: Nooit generate: Uitnodigingslink genereren + invalid: Deze uitnodiging is niet geldig invited_by: 'Jij bent uitgenodigd door:' max_uses: one: 1 keer diff --git a/config/locales/nn.yml b/config/locales/nn.yml index acd6b206e7..4925d44632 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -1368,6 +1368,7 @@ nn: '86400': 1 dag expires_in_prompt: Aldri generate: Lag innbydingslenkje + invalid: Denne invitasjonen er ikkje gyldig invited_by: 'Du vart innboden av:' max_uses: one: 1 bruk diff --git a/config/locales/no.yml b/config/locales/no.yml index 75085fa5ab..a1058bf9f2 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -1368,6 +1368,7 @@ '86400': 1 dag expires_in_prompt: Aldri generate: Generer + invalid: Denne invitasjonen er ikke gyldig invited_by: 'Du ble invitert av:' max_uses: one: 1 bruk diff --git a/config/locales/pl.yml b/config/locales/pl.yml index e02cad0395..6085997248 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1418,6 +1418,7 @@ pl: '86400': dobie expires_in_prompt: Nigdy generate: Wygeneruj + invalid: Niepoprawne zaproszenie invited_by: 'Zostałeś(-aś) zaproszony(-a) przez:' max_uses: few: "%{count} użycia" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index d99c265fe2..3eb2950bd6 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1368,6 +1368,7 @@ pt-BR: '86400': 1 dia expires_in_prompt: Nunca generate: Gerar convite + invalid: Este convite não é válido invited_by: 'Você recebeu convite de:' max_uses: one: 1 uso diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index a40ac02f4c..ce7479aa86 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1368,6 +1368,7 @@ pt-PT: '86400': 1 dia expires_in_prompt: Nunca generate: Gerar hiperligação de convite + invalid: Este convite não é válido invited_by: 'Foi convidado por:' max_uses: one: 1 uso diff --git a/config/locales/simple_form.be.yml b/config/locales/simple_form.be.yml index 1ed6c80848..7ad87cdd9f 100644 --- a/config/locales/simple_form.be.yml +++ b/config/locales/simple_form.be.yml @@ -53,7 +53,7 @@ be: password: Не менш за 8 сімвалаў phrase: Параўнанне адбудзецца нягледзячы на рэгістр тэксту і папярэджанні аб змесціве допісу scopes: Якімі API праграм будзе дазволена карыстацца. Калі вы абярэце найвышэйшы ўзровень, не трэба абіраць асобныя. - setting_aggregate_reblogs: Не паказваць новыя пашырэнні для допісаў, якія нядаўна пашырылі(уплывае выключна на будучыя пашырэнні) + setting_aggregate_reblogs: Не паказваць новыя пашырэнні для допісаў, якія пашырылі нядаўна (закранае толькі нядаўнія пашырэнні) setting_always_send_emails: Звычайна лісты з апавяшчэннямі не будуць дасылацца, калі вы актыўна карыстаецеся Mastodon setting_default_sensitive: Далікатныя медыя прадвызначана схаваныя. Іх можна адкрыць адзіным клікам setting_display_media_default: Хаваць медыя пазначаныя як далікатныя diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 954ef745da..63779e5bd5 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -592,6 +592,8 @@ sk: title: Ohľadom appearance: title: Vzhľad + content_retention: + title: Ponechanie obsahu discovery: follow_recommendations: Odporúčania pre nasledovanie profile_directory: Katalóg profilov @@ -616,6 +618,7 @@ sk: delete: Vymaž nahratý súbor destroyed_msg: Nahratie bolo zo stránky úspešne vymazané! software_updates: + critical_update: Kritické — prosím aktualizuj rýchlo documentation_link: Zisti viac title: Dostupné aktualizácie types: @@ -646,6 +649,10 @@ sk: appeal_approved: Namietnuté appeal_rejected: Námietka zamietnutá system_checks: + elasticsearch_preset: + action: Pozri dokumentáciu + elasticsearch_preset_single_node: + action: Pozri dokumentáciu rules_check: action: Spravuj serverové pravidlá message_html: Neurčil/a si žiadne serverové pravidlá. @@ -925,6 +932,7 @@ sk: '86400': 1 deň expires_in_prompt: Nikdy generate: Vygeneruj + invalid: Táto pozvánka je neplatná invited_by: 'Bol/a si pozvaný/á užívateľom:' max_uses: few: "%{count} využití" diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 77ddfd6e2b..b31fe118a1 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1418,6 +1418,7 @@ sl: '86400': 1 dan expires_in_prompt: Nikoli generate: Ustvari + invalid: To povabilo ni veljavno invited_by: 'Povabil/a vas je:' max_uses: few: "%{count} uporabe" diff --git a/config/locales/sq.yml b/config/locales/sq.yml index e4fb811ce3..bd01a80890 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -1362,6 +1362,7 @@ sq: '86400': 1 ditë expires_in_prompt: Kurrë generate: Prodho lidhje ftese + invalid: Kjo ftesë s’është e vlefshme invited_by: 'Qetë ftuar nga:' max_uses: one: 1 përdorim diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index cba4354f06..6ccec7fd9a 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -1393,6 +1393,7 @@ sr-Latn: '86400': 1 dan expires_in_prompt: Nikad generate: Generiši + invalid: Ova pozivnica nije važeća invited_by: 'Pozvao Vas je:' max_uses: few: "%{count} korišćenja" diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 902f13ad61..407908517b 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1393,6 +1393,7 @@ sr: '86400': 1 дан expires_in_prompt: Никад generate: Генериши + invalid: Ова позивница није важећа invited_by: 'Позвао Вас је:' max_uses: few: "%{count} коришћења" diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 736d839f91..8126455f4c 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1368,6 +1368,7 @@ sv: '86400': 1 dag expires_in_prompt: Aldrig generate: Skapa + invalid: Ogiltig inbjudan invited_by: 'Du blev inbjuden av:' max_uses: one: 1 användning diff --git a/config/locales/th.yml b/config/locales/th.yml index 33d8a898ed..6618998962 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -1343,6 +1343,7 @@ th: '86400': 1 วัน expires_in_prompt: ไม่เลย generate: สร้างลิงก์เชิญ + invalid: คำเชิญนี้ไม่ถูกต้อง invited_by: 'คุณได้รับเชิญโดย:' max_uses: other: "%{count} การใช้งาน" diff --git a/config/locales/tr.yml b/config/locales/tr.yml index c9adfd9132..9d4d95a838 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1368,6 +1368,7 @@ tr: '86400': 1 gün expires_in_prompt: Asla generate: Davet bağlantısı oluştur + invalid: Bu davet geçerli değil invited_by: 'Davet edildiniz:' max_uses: one: 1 kullanım diff --git a/config/locales/uk.yml b/config/locales/uk.yml index eb947a7d0b..2261c647ba 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1418,6 +1418,7 @@ uk: '86400': 1 день expires_in_prompt: Ніколи generate: Згенерувати + invalid: Це запрошення не дійсне invited_by: 'Вас запросив:' max_uses: few: "%{count} використання" diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 7902cea4dd..b98193065b 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1343,6 +1343,7 @@ zh-CN: '86400': 1 天后 expires_in_prompt: 永不过期 generate: 生成邀请链接 + invalid: 此邀请无效 invited_by: 你的邀请人是: max_uses: other: "%{count} 次" diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index 58aeac8414..f13cedad6e 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1343,6 +1343,7 @@ zh-HK: '86400': 1 天後 expires_in_prompt: 永不過期 generate: 生成邀請連結 + invalid: 此邀請無效 invited_by: 你的邀請人是: max_uses: other: "%{count} 次" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 7bcc133964..3063b7afd1 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1345,6 +1345,7 @@ zh-TW: '86400': 1 天後 expires_in_prompt: 永不過期 generate: 建立邀請連結 + invalid: 此邀請是無效的 invited_by: 您的邀請人是: max_uses: other: "%{count} 則" From 4eb4e8b22c564222d8bc69cca754cbfb9a524611 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 12:07:13 +0100 Subject: [PATCH 13/15] Update Yarn to v4.0.2 (#27851) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2230b20ea7..7c73d17c12 100644 --- a/package.json +++ b/package.json @@ -242,5 +242,5 @@ "*.{js,jsx,ts,tsx}": "eslint --fix", "*.{css,scss}": "stylelint --fix" }, - "packageManager": "yarn@4.0.1" + "packageManager": "yarn@4.0.2" } From d562fb84596f7cf2380e7c1cc465e1d4d478d759 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 14 Nov 2023 09:34:30 -0500 Subject: [PATCH 14/15] Specs for minimal CSP policy in `Api::` controllers (#27845) --- app/controllers/api/base_controller.rb | 21 +-------- .../concerns/api/content_security_policy.rb | 27 ++++++++++++ spec/requests/api/v1/csp_spec.rb | 43 +++++++++++++++++++ 3 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 app/controllers/concerns/api/content_security_policy.rb create mode 100644 spec/requests/api/v1/csp_spec.rb diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index c764b45101..135c575658 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -7,6 +7,7 @@ class Api::BaseController < ApplicationController include RateLimitHeaders include AccessTokenTrackingConcern include ApiCachingConcern + include Api::ContentSecurityPolicy skip_before_action :require_functional!, unless: :limited_federation_mode? @@ -17,26 +18,6 @@ class Api::BaseController < ApplicationController protect_from_forgery with: :null_session - content_security_policy do |p| - # Set every directive that does not have a fallback - p.default_src :none - p.frame_ancestors :none - p.form_action :none - - # Disable every directive with a fallback to cut on response size - p.base_uri false - p.font_src false - p.img_src false - p.style_src false - p.media_src false - p.frame_src false - p.manifest_src false - p.connect_src false - p.script_src false - p.child_src false - p.worker_src false - end - rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e| render json: { error: e.to_s }, status: 422 end diff --git a/app/controllers/concerns/api/content_security_policy.rb b/app/controllers/concerns/api/content_security_policy.rb new file mode 100644 index 0000000000..8116dca57b --- /dev/null +++ b/app/controllers/concerns/api/content_security_policy.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Api::ContentSecurityPolicy + extend ActiveSupport::Concern + + included do + content_security_policy do |policy| + # Set every directive that does not have a fallback + policy.default_src :none + policy.frame_ancestors :none + policy.form_action :none + + # Disable every directive with a fallback to cut on response size + policy.base_uri false + policy.font_src false + policy.img_src false + policy.style_src false + policy.media_src false + policy.frame_src false + policy.manifest_src false + policy.connect_src false + policy.script_src false + policy.child_src false + policy.worker_src false + end + end +end diff --git a/spec/requests/api/v1/csp_spec.rb b/spec/requests/api/v1/csp_spec.rb new file mode 100644 index 0000000000..2db52ac725 --- /dev/null +++ b/spec/requests/api/v1/csp_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'API namespace minimal Content-Security-Policy' do + before { stub_tests_controller } + + after { Rails.application.reload_routes! } + + it 'returns the correct CSP headers' do + get '/api/v1/tests' + + expect(response).to have_http_status(200) + expect(response.headers['Content-Security-Policy']).to eq(minimal_csp_headers) + end + + private + + def stub_tests_controller + stub_const('Api::V1::TestsController', api_tests_controller) + + Rails.application.routes.draw do + get '/api/v1/tests', to: 'api/v1/tests#index' + end + end + + def api_tests_controller + Class.new(Api::BaseController) do + def index + head 200 + end + + private + + def user_signed_in? = false + def current_user = nil + end + end + + def minimal_csp_headers + "default-src 'none'; frame-ancestors 'none'; form-action 'none'" + end +end From b2c5b20ef27edd948eca8d6bd2014b7a5efaec11 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 14 Nov 2023 09:52:59 -0500 Subject: [PATCH 15/15] Fix `RSpec/AnyInstance` cop (#27810) --- .rubocop_todo.yml | 17 ---------- .../activitypub/inboxes_controller_spec.rb | 2 +- .../admin/accounts_controller_spec.rb | 3 +- .../admin/resets_controller_spec.rb | 18 ++++++++--- .../auth/sessions_controller_spec.rb | 6 ++-- .../confirmations_controller_spec.rb | 31 +++++++++---------- .../recovery_codes_controller_spec.rb | 6 ++-- spec/lib/request_spec.rb | 5 ++- spec/lib/status_filter_spec.rb | 6 ++-- spec/models/account_spec.rb | 14 +++++++-- spec/models/setting_spec.rb | 6 ++-- .../process_collection_service_spec.rb | 9 ++++-- .../activitypub/delivery_worker_spec.rb | 3 +- .../web/push_notification_worker_spec.rb | 4 +-- 14 files changed, 70 insertions(+), 60 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f9d14fd551..1672046048 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -41,23 +41,6 @@ Metrics/CyclomaticComplexity: Metrics/PerceivedComplexity: Max: 27 -RSpec/AnyInstance: - Exclude: - - 'spec/controllers/activitypub/inboxes_controller_spec.rb' - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/resets_controller_spec.rb' - - 'spec/controllers/auth/sessions_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb' - - 'spec/lib/request_spec.rb' - - 'spec/lib/status_filter_spec.rb' - - 'spec/models/account_spec.rb' - - 'spec/models/setting_spec.rb' - - 'spec/services/activitypub/process_collection_service_spec.rb' - - 'spec/validators/follow_limit_validator_spec.rb' - - 'spec/workers/activitypub/delivery_worker_spec.rb' - - 'spec/workers/web/push_notification_worker_spec.rb' - # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 22 diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb index 030a303266..feca543cb7 100644 --- a/spec/controllers/activitypub/inboxes_controller_spec.rb +++ b/spec/controllers/activitypub/inboxes_controller_spec.rb @@ -58,7 +58,7 @@ RSpec.describe ActivityPub::InboxesController do before do allow(ActivityPub::FollowersSynchronizationWorker).to receive(:perform_async).and_return(nil) - allow_any_instance_of(Account).to receive(:local_followers_hash).and_return('somehash') + allow(remote_account).to receive(:local_followers_hash).and_return('somehash') request.headers['Collection-Synchronization'] = synchronization_header post :create, body: '{}' diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 3b8fa2f71c..307e819501 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -227,7 +227,8 @@ RSpec.describe Admin::AccountsController do let(:account) { Fabricate(:account, domain: 'example.com') } before do - allow_any_instance_of(ResolveAccountService).to receive(:call) + service = instance_double(ResolveAccountService, call: nil) + allow(ResolveAccountService).to receive(:new).and_return(service) end context 'when user is admin' do diff --git a/spec/controllers/admin/resets_controller_spec.rb b/spec/controllers/admin/resets_controller_spec.rb index 16adb8a128..14826973c1 100644 --- a/spec/controllers/admin/resets_controller_spec.rb +++ b/spec/controllers/admin/resets_controller_spec.rb @@ -13,12 +13,20 @@ describe Admin::ResetsController do describe 'POST #create' do it 'redirects to admin accounts page' do - expect_any_instance_of(User).to receive(:send_reset_password_instructions) do |value| - expect(value.account_id).to eq account.id - end - - post :create, params: { account_id: account.id } + expect do + post :create, params: { account_id: account.id } + end.to change(Devise.mailer.deliveries, :size).by(2) + expect(Devise.mailer.deliveries).to have_attributes( + first: have_attributes( + to: include(account.user.email), + subject: I18n.t('devise.mailer.password_change.subject') + ), + last: have_attributes( + to: include(account.user.email), + subject: I18n.t('devise.mailer.reset_password_instructions.subject') + ) + ) expect(response).to redirect_to(admin_account_path(account.id)) end end diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index 049190e2ee..f341d75b79 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -126,7 +126,7 @@ RSpec.describe Auth::SessionsController do let!(:previous_login) { Fabricate(:login_activity, user: user, ip: previous_ip) } before do - allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip).and_return(current_ip) + allow(controller.request).to receive(:remote_ip).and_return(current_ip) user.update(current_sign_in_at: 1.month.ago) post :create, params: { user: { email: user.email, password: user.password } } end @@ -279,7 +279,9 @@ RSpec.describe Auth::SessionsController do context 'when the server has an decryption error' do before do - allow_any_instance_of(User).to receive(:validate_and_consume_otp!).and_raise(OpenSSL::Cipher::CipherError) + allow(user).to receive(:validate_and_consume_otp!).with(user.current_otp).and_raise(OpenSSL::Cipher::CipherError) + allow(User).to receive(:find_by).with(id: user.id).and_return(user) + post :create, params: { user: { otp_attempt: user.current_otp } }, session: { attempt_user_id: user.id, attempt_user_updated_at: user.updated_at.to_s } end diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb index 37381fe1f7..a5a35e91d0 100644 --- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb @@ -61,6 +61,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do it 'renders page with success' do prepare_user_otp_generation prepare_user_otp_consumption + allow(controller).to receive(:current_user).and_return(user) expect do post :create, @@ -75,30 +76,28 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do end def prepare_user_otp_generation - expect_any_instance_of(User).to receive(:generate_otp_backup_codes!) do |value| - expect(value).to eq user - otp_backup_codes - end + allow(user) + .to receive(:generate_otp_backup_codes!) + .and_return(otp_backup_codes) end def prepare_user_otp_consumption - expect_any_instance_of(User).to receive(:validate_and_consume_otp!) do |value, code, options| - expect(value).to eq user - expect(code).to eq '123456' - expect(options).to eq({ otp_secret: 'thisisasecretforthespecofnewview' }) - true - end + options = { otp_secret: 'thisisasecretforthespecofnewview' } + allow(user) + .to receive(:validate_and_consume_otp!) + .with('123456', options) + .and_return(true) end end describe 'when creation fails' do subject do - expect_any_instance_of(User).to receive(:validate_and_consume_otp!) do |value, code, options| - expect(value).to eq user - expect(code).to eq '123456' - expect(options).to eq({ otp_secret: 'thisisasecretforthespecofnewview' }) - false - end + options = { otp_secret: 'thisisasecretforthespecofnewview' } + allow(user) + .to receive(:validate_and_consume_otp!) + .with('123456', options) + .and_return(false) + allow(controller).to receive(:current_user).and_return(user) expect do post :create, diff --git a/spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb index 630cec428e..28a40e138c 100644 --- a/spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb @@ -9,10 +9,8 @@ describe Settings::TwoFactorAuthentication::RecoveryCodesController do it 'updates the codes and shows them on a view when signed in' do user = Fabricate(:user) otp_backup_codes = user.generate_otp_backup_codes! - expect_any_instance_of(User).to receive(:generate_otp_backup_codes!) do |value| - expect(value).to eq user - otp_backup_codes - end + allow(user).to receive(:generate_otp_backup_codes!).and_return(otp_backup_codes) + allow(controller).to receive(:current_user).and_return(user) sign_in user, scope: :user post :create, session: { challenge_passed_at: Time.now.utc } diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb index f0861376b9..c7620cf9b6 100644 --- a/spec/lib/request_spec.rb +++ b/spec/lib/request_spec.rb @@ -64,8 +64,11 @@ describe Request do end it 'closes underlying connection' do - expect_any_instance_of(HTTP::Client).to receive(:close) + allow(subject.send(:http_client)).to receive(:close) + expect { |block| subject.perform(&block) }.to yield_control + + expect(subject.send(:http_client)).to have_received(:close) end it 'returns response which implements body_with_limit' do diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb index c994ad419f..cf6f3c7959 100644 --- a/spec/lib/status_filter_spec.rb +++ b/spec/lib/status_filter_spec.rb @@ -23,7 +23,8 @@ describe StatusFilter do context 'when status policy does not allow show' do it 'filters the status' do - allow_any_instance_of(StatusPolicy).to receive(:show?).and_return(false) + policy = instance_double(StatusPolicy, show?: false) + allow(StatusPolicy).to receive(:new).and_return(policy) expect(filter).to be_filtered end @@ -74,7 +75,8 @@ describe StatusFilter do context 'when status policy does not allow show' do it 'filters the status' do - allow_any_instance_of(StatusPolicy).to receive(:show?).and_return(false) + policy = instance_double(StatusPolicy, show?: false) + allow(StatusPolicy).to receive(:new).and_return(policy) expect(filter).to be_filtered end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index b5d942412e..f77ecb055a 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -209,9 +209,13 @@ RSpec.describe Account do expect(account.refresh!).to be_nil end - it 'calls not ResolveAccountService#call' do - expect_any_instance_of(ResolveAccountService).to_not receive(:call).with(acct) + it 'does not call ResolveAccountService#call' do + service = instance_double(ResolveAccountService, call: nil) + allow(ResolveAccountService).to receive(:new).and_return(service) + account.refresh! + + expect(service).to_not have_received(:call).with(acct) end end @@ -219,8 +223,12 @@ RSpec.describe Account do let(:domain) { 'example.com' } it 'calls ResolveAccountService#call' do - expect_any_instance_of(ResolveAccountService).to receive(:call).with(acct).once + service = instance_double(ResolveAccountService, call: nil) + allow(ResolveAccountService).to receive(:new).and_return(service) + account.refresh! + + expect(service).to have_received(:call).with(acct).once end end end diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index b08136a1c1..e98062810e 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -52,7 +52,8 @@ RSpec.describe Setting do before do allow(RailsSettings::Settings).to receive(:object).with(key).and_return(object) allow(described_class).to receive(:default_settings).and_return(default_settings) - allow_any_instance_of(Settings::ScopedSettings).to receive(:thing_scoped).and_return(records) + settings_double = instance_double(Settings::ScopedSettings, thing_scoped: records) + allow(Settings::ScopedSettings).to receive(:new).and_return(settings_double) Rails.cache.delete(cache_key) end @@ -128,7 +129,8 @@ RSpec.describe Setting do describe '.all_as_records' do before do - allow_any_instance_of(Settings::ScopedSettings).to receive(:thing_scoped).and_return(records) + settings_double = instance_double(Settings::ScopedSettings, thing_scoped: records) + allow(Settings::ScopedSettings).to receive(:new).and_return(settings_double) allow(described_class).to receive(:default_settings).and_return(default_settings) end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index ede9f5c049..df526daf34 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -76,7 +76,8 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do let(:forwarder) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/other_account') } it 'does not process payload if no signature exists' do - allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) + signature_double = instance_double(ActivityPub::LinkedDataSignature, verify_actor!: nil) + allow(ActivityPub::LinkedDataSignature).to receive(:new).and_return(signature_double) allow(ActivityPub::Activity).to receive(:factory) subject.call(json, forwarder) @@ -87,7 +88,8 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do it 'processes payload with actor if valid signature exists' do payload['signature'] = { 'type' => 'RsaSignature2017' } - allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(actor) + signature_double = instance_double(ActivityPub::LinkedDataSignature, verify_actor!: actor) + allow(ActivityPub::LinkedDataSignature).to receive(:new).and_return(signature_double) allow(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) subject.call(json, forwarder) @@ -98,7 +100,8 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do it 'does not process payload if invalid signature exists' do payload['signature'] = { 'type' => 'RsaSignature2017' } - allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) + signature_double = instance_double(ActivityPub::LinkedDataSignature, verify_actor!: nil) + allow(ActivityPub::LinkedDataSignature).to receive(:new).and_return(signature_double) allow(ActivityPub::Activity).to receive(:factory) subject.call(json, forwarder) diff --git a/spec/workers/activitypub/delivery_worker_spec.rb b/spec/workers/activitypub/delivery_worker_spec.rb index d39393d507..efce610ae4 100644 --- a/spec/workers/activitypub/delivery_worker_spec.rb +++ b/spec/workers/activitypub/delivery_worker_spec.rb @@ -11,7 +11,8 @@ describe ActivityPub::DeliveryWorker do let(:payload) { 'test' } before do - allow_any_instance_of(Account).to receive(:remote_followers_hash).with('https://example.com/api').and_return('somehash') + allow(sender).to receive(:remote_followers_hash).with('https://example.com/api').and_return('somehash') + allow(Account).to receive(:find).with(sender.id).and_return(sender) end describe 'perform' do diff --git a/spec/workers/web/push_notification_worker_spec.rb b/spec/workers/web/push_notification_worker_spec.rb index 822ef5257f..637206a409 100644 --- a/spec/workers/web/push_notification_worker_spec.rb +++ b/spec/workers/web/push_notification_worker_spec.rb @@ -23,8 +23,8 @@ describe Web::PushNotificationWorker do describe 'perform' do before do - allow_any_instance_of(subscription.class).to receive(:contact_email).and_return(contact_email) - allow_any_instance_of(subscription.class).to receive(:vapid_key).and_return(vapid_key) + allow(subscription).to receive_messages(contact_email: contact_email, vapid_key: vapid_key) + allow(Web::PushSubscription).to receive(:find).with(subscription.id).and_return(subscription) allow(Webpush::Encryption).to receive(:encrypt).and_return(payload) allow(JWT).to receive(:encode).and_return('jwt.encoded.payload')