From 0ec695e036dab45d57598f451266bd0b176df9fd Mon Sep 17 00:00:00 2001 From: CommanderRoot Date: Mon, 4 Apr 2022 18:19:45 +0200 Subject: [PATCH 1/9] Replace deprecated String.prototype.substr() (#17949) * Replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated * Change String.prototype.substring() to String.prototype.slice() .substring() and .slice() work very similary but .slice() is a bit faster and stricter * Add ESLint rule to forbid usage of .substr and .substring .substr() is deprecated and .substring() is very similar to .slice() so better to use .slice() at all times Signed-off-by: Tobias Speicher --- .eslintrc.js | 5 +++++ .../mastodon/features/emoji/emoji_mart_search_light.js | 2 +- app/javascript/mastodon/features/status/components/card.js | 2 +- app/javascript/mastodon/features/video/index.js | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7dda011082..2a882f59c6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -79,6 +79,11 @@ module.exports = { 'no-irregular-whitespace': 'error', 'no-mixed-spaces-and-tabs': 'warn', 'no-nested-ternary': 'warn', + 'no-restricted-properties': [ + 'error', + { property: 'substring', message: 'Use .slice instead of .substring.' }, + { property: 'substr', message: 'Use .slice instead of .substr.' }, + ], 'no-trailing-spaces': 'warn', 'no-undef': 'error', 'no-unreachable': 'error', diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js index e4519a13e6..70694ab6dd 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js @@ -124,7 +124,7 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude, custo for (let id in aPool) { let emoji = aPool[id], { search } = emoji, - sub = value.substr(0, length), + sub = value.slice(0, length), subIndex = search.indexOf(sub); if (subIndex !== -1) { diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 90f9ae7ae6..3d81bcb29b 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -32,7 +32,7 @@ const trim = (text, len) => { return text; } - return text.substring(0, cut) + (text.length > len ? '…' : ''); + return text.slice(0, cut) + (text.length > len ? '…' : ''); }; const domParser = new DOMParser(); diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index 8d47e479a8..4f90e955fe 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -91,7 +91,7 @@ export const fileNameFromURL = str => { const pathname = url.pathname; const index = pathname.lastIndexOf('/'); - return pathname.substring(index + 1); + return pathname.slice(index + 1); }; export default @injectIntl From 275dad97024d010853d995350b5224c0a3edc400 Mon Sep 17 00:00:00 2001 From: rinsuki <428rinsuki+git@gmail.com> Date: Tue, 5 Apr 2022 19:00:31 +0900 Subject: [PATCH 2/9] fix: returns nil instead of empty URL on status.application.website (#17962) --- app/serializers/rest/status_serializer.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 32c4e405ef..6bd6a23e51 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -137,6 +137,10 @@ class REST::StatusSerializer < ActiveModel::Serializer class ApplicationSerializer < ActiveModel::Serializer attributes :name, :website + + def website + object.website.presence + end end class MentionSerializer < ActiveModel::Serializer From 95256f26f5160abd1b28f087e119c2a762420524 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:01:48 +0900 Subject: [PATCH 3/9] Bump pg from 1.3.4 to 1.3.5 (#17953) Bumps [pg](https://github.com/ged/ruby-pg) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/ged/ruby-pg/releases) - [Changelog](https://github.com/ged/ruby-pg/blob/master/History.rdoc) - [Commits](https://github.com/ged/ruby-pg/commits) --- updated-dependencies: - dependency-name: pg dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 16492c41e0..1019ebe10b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -437,7 +437,7 @@ GEM parslet (2.0.0) pastel (0.8.0) tty-color (~> 0.5) - pg (1.3.4) + pg (1.3.5) pghero (2.8.2) activerecord (>= 5) pkg-config (1.4.7) From b15b41cb2c0d137af277f83d55afbbe3d41dd3d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:02:07 +0900 Subject: [PATCH 4/9] Bump ox from 2.14.10 to 2.14.11 (#17954) Bumps [ox](https://github.com/ohler55/ox) from 2.14.10 to 2.14.11. - [Release notes](https://github.com/ohler55/ox/releases) - [Changelog](https://github.com/ohler55/ox/blob/develop/CHANGELOG.md) - [Commits](https://github.com/ohler55/ox/compare/v2.14.10...v2.14.11) --- updated-dependencies: - dependency-name: ox dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1019ebe10b..c17a1dedf9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -430,7 +430,7 @@ GEM openssl (2.2.0) openssl-signature_algorithm (0.4.0) orm_adapter (0.5.0) - ox (2.14.10) + ox (2.14.11) parallel (1.22.1) parser (3.1.1.0) ast (~> 2.4.1) From bf29651fe32d01146c758b88c429ff193868f8ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:02:35 +0900 Subject: [PATCH 5/9] Bump react-redux from 7.2.6 to 7.2.8 (#17955) Bumps [react-redux](https://github.com/reduxjs/react-redux) from 7.2.6 to 7.2.8. - [Release notes](https://github.com/reduxjs/react-redux/releases) - [Changelog](https://github.com/reduxjs/react-redux/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/react-redux/compare/v7.2.6...v7.2.8) --- updated-dependencies: - dependency-name: react-redux dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 35966f2f45..86c41c98af 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "react-motion": "^0.5.2", "react-notification": "^6.8.5", "react-overlays": "^0.9.3", - "react-redux": "^7.2.6", + "react-redux": "^7.2.8", "react-redux-loading-bar": "^4.0.8", "react-router-dom": "^4.1.1", "react-router-scroll-4": "^1.0.0-beta.1", diff --git a/yarn.lock b/yarn.lock index f59fcc41bc..9cb1ee1b1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9011,10 +9011,10 @@ react-redux-loading-bar@^4.0.8: prop-types "^15.6.2" react-lifecycles-compat "^3.0.2" -react-redux@^7.2.6: - version "7.2.6" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.6.tgz#49633a24fe552b5f9caf58feb8a138936ddfe9aa" - integrity sha512-10RPdsz0UUrRL1NZE0ejTkucnclYSgXp5q+tB5SWx2qeG2ZJQJyymgAhwKy73yiL/13btfB6fPr+rgbMAaZIAQ== +react-redux@^7.2.8: + version "7.2.8" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.8.tgz#a894068315e65de5b1b68899f9c6ee0923dd28de" + integrity sha512-6+uDjhs3PSIclqoCk0kd6iX74gzrGc3W5zcAjbrFgEdIjRSQObdIwfx80unTkVUYvbQ95Y8Av3OvFHq1w5EOUw== dependencies: "@babel/runtime" "^7.15.4" "@types/react-redux" "^7.1.20" From c35ef5cb498c69769dc791df01d43852df6d4e95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:02:51 +0900 Subject: [PATCH 6/9] Bump sidekiq-unique-jobs from 7.1.15 to 7.1.16 (#17956) Bumps [sidekiq-unique-jobs](https://github.com/mhenrixon/sidekiq-unique-jobs) from 7.1.15 to 7.1.16. - [Release notes](https://github.com/mhenrixon/sidekiq-unique-jobs/releases) - [Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/main/CHANGELOG.md) - [Commits](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.15...v7.1.16) --- updated-dependencies: - dependency-name: sidekiq-unique-jobs dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c17a1dedf9..e9e246be97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -604,7 +604,7 @@ GEM sidekiq (>= 3) thwait tilt (>= 1.4.0) - sidekiq-unique-jobs (7.1.15) + sidekiq-unique-jobs (7.1.16) brpoplpush-redis_script (> 0.1.1, <= 2.0.0) concurrent-ruby (~> 1.0, >= 1.0.5) sidekiq (>= 5.0, < 8.0) From 76f7759ecbc1e0522c7c88965e9e1d3a7953f0b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:03:13 +0900 Subject: [PATCH 7/9] Bump redis from 4.0.4 to 4.0.6 (#17957) Bumps [redis](https://github.com/redis/node-redis) from 4.0.4 to 4.0.6. - [Release notes](https://github.com/redis/node-redis/releases) - [Changelog](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/node-redis/compare/redis@4.0.4...redis@4.0.6) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 86c41c98af..215c03f394 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "react-swipeable-views": "^0.14.0", "react-textarea-autosize": "^8.3.3", "react-toggle": "^4.1.2", - "redis": "^4.0.4", + "redis": "^4.0.6", "redux": "^4.1.2", "redux-immutable": "^4.0.0", "redux-thunk": "^2.4.1", diff --git a/yarn.lock b/yarn.lock index 9cb1ee1b1f..7a1a22eebe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1415,10 +1415,10 @@ resolved "https://registry.yarnpkg.com/@node-redis/bloom/-/bloom-1.0.1.tgz#144474a0b7dc4a4b91badea2cfa9538ce0a1854e" integrity sha512-mXEBvEIgF4tUzdIN89LiYsbi6//EdpFA7L8M+DHCvePXg+bfHWi+ct5VI6nHUFQE5+ohm/9wmgihCH3HSkeKsw== -"@node-redis/client@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@node-redis/client/-/client-1.0.4.tgz#fe185750df3bcc07524f63fe8dbc8d14d22d6cbb" - integrity sha512-IM/NRAqg7MvNC3bIRQipXGrEarunrdgvrbAzsd3ty93LSHi/M+ybQulOERQi8a3M+P5BL8HenwXjiIoKm6ml2g== +"@node-redis/client@1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@node-redis/client/-/client-1.0.5.tgz#ebac5e2bbf12214042a37621604973a954ede755" + integrity sha512-ESZ3bd1f+od62h4MaBLKum+klVJfA4wAeLHcVQBkoXa1l0viFesOWnakLQqKg+UyrlJhZmXJWtu0Y9v7iTMrig== dependencies: cluster-key-slot "1.1.0" generic-pool "3.8.2" @@ -1435,10 +1435,10 @@ resolved "https://registry.yarnpkg.com/@node-redis/json/-/json-1.0.2.tgz#8ad2d0f026698dc1a4238cc3d1eb099a3bee5ab8" integrity sha512-qVRgn8WfG46QQ08CghSbY4VhHFgaTY71WjpwRBGEuqGPfWwfRcIf3OqSpR7Q/45X+v3xd8mvYjywqh0wqJ8T+g== -"@node-redis/search@1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@node-redis/search/-/search-1.0.3.tgz#7c3d026bf994caf82019fd0c3924cfc09f041a29" - integrity sha512-rsrzkGWI84di/uYtEctS/4qLusWt0DESx/psjfB0TFpORDhe7JfC0h8ary+eHulTksumor244bXLRSqQXbFJmw== +"@node-redis/search@1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@node-redis/search/-/search-1.0.5.tgz#96050007eb7c50a7e47080320b4f12aca8cf94c4" + integrity sha512-MCOL8iCKq4v+3HgEQv8zGlSkZyXSXtERgrAJ4TSryIG/eLFy84b57KmNNa/V7M1Q2Wd2hgn2nPCGNcQtk1R1OQ== "@node-redis/time-series@1.0.2": version "1.0.2" @@ -9229,16 +9229,16 @@ redis-parser@3.0.0: dependencies: redis-errors "^1.0.0" -redis@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/redis/-/redis-4.0.4.tgz#b567f82f59086df38433982f7f424b48e924ec7a" - integrity sha512-KaM1OAj/nGrSeybmmOWSMY0LXTGT6FVWgUZZrd2MYzXKJ+VGtqVaciGQeNMfZiQX+kDM8Ke4uttb54m2rm6V0A== +redis@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/redis/-/redis-4.0.6.tgz#a2ded4d9f4f4bad148e54781051618fc684cd858" + integrity sha512-IaPAxgF5dV0jx+A9l6yd6R9/PAChZIoAskDVRzUODeLDNhsMlq7OLLTmu0AwAr0xjrJ1bibW5xdpRwqIQ8Q0Xg== dependencies: "@node-redis/bloom" "1.0.1" - "@node-redis/client" "1.0.4" + "@node-redis/client" "1.0.5" "@node-redis/graph" "1.0.0" "@node-redis/json" "1.0.2" - "@node-redis/search" "1.0.3" + "@node-redis/search" "1.0.5" "@node-redis/time-series" "1.0.2" redux-immutable@^4.0.0: From 5e49cb8f0f35f2fa718fb86fccd996661624c02a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:03:26 +0900 Subject: [PATCH 8/9] Bump prettier from 2.6.1 to 2.6.2 (#17958) Bumps [prettier](https://github.com/prettier/prettier) from 2.6.1 to 2.6.2. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.6.1...2.6.2) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 215c03f394..388eea1395 100644 --- a/package.json +++ b/package.json @@ -184,7 +184,7 @@ "eslint-plugin-promise": "~6.0.0", "eslint-plugin-react": "~7.29.4", "jest": "^27.5.1", - "prettier": "^2.6.1", + "prettier": "^2.6.2", "raf": "^3.4.1", "react-intl-translations-manager": "^5.0.3", "react-test-renderer": "^16.14.0", diff --git a/yarn.lock b/yarn.lock index 7a1a22eebe..db9fb41d6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8651,10 +8651,10 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.1.tgz#d472797e0d7461605c1609808e27b80c0f9cfe17" - integrity sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A== +prettier@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032" + integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew== pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" From 04b4b541f81e82f4ee3c8e5283123450df949a4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 03:03:45 +0900 Subject: [PATCH 9/9] Bump sass from 1.49.9 to 1.49.11 (#17959) Bumps [sass](https://github.com/sass/dart-sass) from 1.49.9 to 1.49.11. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.49.9...1.49.11) --- updated-dependencies: - dependency-name: sass dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 388eea1395..e39fe7bcb0 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "requestidlecallback": "^0.3.0", "reselect": "^4.1.5", "rimraf": "^3.0.2", - "sass": "^1.49.9", + "sass": "^1.49.11", "sass-loader": "^10.2.0", "stacktrace-js": "^2.0.2", "stringz": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index db9fb41d6d..aa290014cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9616,10 +9616,10 @@ sass-loader@^10.2.0: schema-utils "^3.0.0" semver "^7.3.2" -sass@^1.49.9: - version "1.49.9" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.9.tgz#b15a189ecb0ca9e24634bae5d1ebc191809712f9" - integrity sha512-YlYWkkHP9fbwaFRZQRXgDi3mXZShslVmmo+FVK3kHLUELHHEYrCmL1x6IUjC7wLS6VuJSAFXRQS/DxdsC4xL1A== +sass@^1.49.11: + version "1.49.11" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.11.tgz#1ffeb77faeed8b806a2a1e021d7c9fd3fc322cb7" + integrity sha512-wvS/geXgHUGs6A/4ud5BFIWKO1nKd7wYIGimDk4q4GFkJicILActpv9ueMT4eRGSsp1BdKHuw1WwAHXbhsJELQ== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0"