From 9b89c62d438acc48caa6cdf939ced90a75a86c5b Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 10 Nov 2018 20:42:04 +0100 Subject: [PATCH 01/12] Check that twitter:player is valid before using it (#9254) Fixes #9251 --- app/services/fetch_link_card_service.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 3e77579bb..38c578de2 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -136,14 +136,15 @@ class FetchLinkCardService < BaseService detector = CharlockHolmes::EncodingDetector.new detector.strip_tags = true - guess = detector.detect(@html, @html_charset) - page = Nokogiri::HTML(@html, nil, guess&.fetch(:encoding, nil)) + guess = detector.detect(@html, @html_charset) + page = Nokogiri::HTML(@html, nil, guess&.fetch(:encoding, nil)) + player_url = meta_property(page, 'twitter:player') - if meta_property(page, 'twitter:player') + if player_url && !bad_url?(Addressable::URI.parse(player_url)) @card.type = :video @card.width = meta_property(page, 'twitter:player:width') || 0 @card.height = meta_property(page, 'twitter:player:height') || 0 - @card.html = content_tag(:iframe, nil, src: meta_property(page, 'twitter:player'), + @card.html = content_tag(:iframe, nil, src: player_url, width: @card.width, height: @card.height, allowtransparency: 'true', From 7f5a4be58010123bad46c0c7644258630724a80e Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 10 Nov 2018 23:59:51 +0100 Subject: [PATCH 02/12] Fix emoji update date processing (#9255) --- app/lib/activitypub/activity/create.rb | 2 +- app/services/activitypub/process_account_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 45079e2b3..9d2ddd3f6 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -177,7 +177,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity updated = tag['updated'] emoji = CustomEmoji.find_by(shortcode: shortcode, domain: @account.domain) - return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && emoji.updated_at >= updated) + return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && updated >= emoji.updated_at) emoji ||= CustomEmoji.new(domain: @account.domain, shortcode: shortcode, uri: uri) emoji.image_remote_url = image_url diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index c77858f1d..5c865dae2 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -232,7 +232,7 @@ class ActivityPub::ProcessAccountService < BaseService updated = tag['updated'] emoji = CustomEmoji.find_by(shortcode: shortcode, domain: @account.domain) - return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && emoji.updated_at >= updated) + return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && updated >= emoji.updated_at) emoji ||= CustomEmoji.new(domain: @account.domain, shortcode: shortcode, uri: uri) emoji.image_remote_url = image_url From 208d278cbcb0e743c8824dc1587cae4050edf8d7 Mon Sep 17 00:00:00 2001 From: mayaeh Date: Mon, 12 Nov 2018 02:57:16 +0900 Subject: [PATCH 03/12] i18n: Add ja translations (#9261) * Run yarn manage:translations * Add Japanese translations. --- .../mastodon/locales/defaultMessages.json | 47 +++++++++++++++++++ app/javascript/mastodon/locales/en.json | 12 +++-- app/javascript/mastodon/locales/ja.json | 15 ++++-- 3 files changed, 66 insertions(+), 8 deletions(-) diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json index 64735c0ab..350979212 100644 --- a/app/javascript/mastodon/locales/defaultMessages.json +++ b/app/javascript/mastodon/locales/defaultMessages.json @@ -349,6 +349,10 @@ { "defaultMessage": "{name} boosted", "id": "status.reblogged_by" + }, + { + "defaultMessage": "Show thread", + "id": "status.show_thread" } ], "path": "app/javascript/mastodon/components/status.json" @@ -471,6 +475,15 @@ ], "path": "app/javascript/mastodon/features/account_timeline/containers/header_container.json" }, + { + "descriptors": [ + { + "defaultMessage": "No toots here!", + "id": "empty_column.account_timeline" + } + ], + "path": "app/javascript/mastodon/features/account_timeline/index.json" + }, { "descriptors": [ { @@ -578,6 +591,7 @@ "id": "account.unendorse" }, { + "defaultMessage": "Add or Remove from lists", "id": "account.add_or_remove_from_list" }, { @@ -1277,6 +1291,39 @@ }, { "descriptors": [ + { + "defaultMessage": "Any of these", + "id": "hashtag.column_settings.tag_mode.any" + }, + { + "defaultMessage": "All of these", + "id": "hashtag.column_settings.tag_mode.all" + }, + { + "defaultMessage": "None of these", + "id": "hashtag.column_settings.tag_mode.none" + }, + { + "defaultMessage": "Include additional tags in this column", + "id": "hashtag.column_settings.tag_toggle" + } + ], + "path": "app/javascript/mastodon/features/hashtag_timeline/components/column_settings.json" + }, + { + "descriptors": [ + { + "defaultMessage": "or {additional}", + "id": "hashtag.column_header.tag_mode.any" + }, + { + "defaultMessage": "and {additional}", + "id": "hashtag.column_header.tag_mode.all" + }, + { + "defaultMessage": "without {additional}", + "id": "hashtag.column_header.tag_mode.none" + }, { "defaultMessage": "There is nothing in this hashtag yet.", "id": "empty_column.hashtag" diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 665fc3a3c..a85d03455 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -112,6 +112,7 @@ "emoji_button.search_results": "Search results", "emoji_button.symbols": "Symbols", "emoji_button.travel": "Travel & Places", + "empty_column.account_timeline": "No toots here!", "empty_column.blocks": "You haven't blocked any users yet.", "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.direct": "You don't have any direct messages yet. When you send or receive one, it will show up here.", @@ -137,13 +138,13 @@ "getting_started.open_source_notice": "Mastodon is open source software. You can contribute or report issues on GitHub at {github}.", "getting_started.security": "Security", "getting_started.terms": "Terms of service", - "hashtag.column_settings.tag_toggle": "Include additional tags for this column", - "hashtag.column_settings.tag_mode.any": "Any of these", - "hashtag.column_settings.tag_mode.all": "All of these", - "hashtag.column_settings.tag_mode.none": "None of these", - "hashtag.column_header.tag_mode.any": "{tag} or {additional}", "hashtag.column_header.tag_mode.all": "{tag} and {additional}", + "hashtag.column_header.tag_mode.any": "{tag} or {additional}", "hashtag.column_header.tag_mode.none": "{tag} without {additional}", + "hashtag.column_settings.tag_mode.all": "All of these", + "hashtag.column_settings.tag_mode.any": "Any of these", + "hashtag.column_settings.tag_mode.none": "None of these", + "hashtag.column_settings.tag_toggle": "Include additional tags for this column", "home.column_settings.basic": "Basic", "home.column_settings.show_reblogs": "Show boosts", "home.column_settings.show_replies": "Show replies", @@ -320,6 +321,7 @@ "status.show_less_all": "Show less for all", "status.show_more": "Show more", "status.show_more_all": "Show more for all", + "status.show_thread": "Show thread", "status.unmute_conversation": "Unmute conversation", "status.unpin": "Unpin from profile", "suggestions.dismiss": "Dismiss suggestion", diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index 8f3f5c23c..3fade1906 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -1,5 +1,5 @@ { - "account.add_or_remove_from_list": "Add or Remove from lists", + "account.add_or_remove_from_list": "リストに追加または外す", "account.badges.bot": "Bot", "account.block": "@{name}さんをブロック", "account.block_domain": "{domain}全体を非表示", @@ -112,6 +112,7 @@ "emoji_button.search_results": "検索結果", "emoji_button.symbols": "記号", "emoji_button.travel": "旅行と場所", + "empty_column.account_timeline": "トゥートがありません!", "empty_column.blocks": "まだ誰もブロックしていません。", "empty_column.community": "ローカルタイムラインはまだ使われていません。何か書いてみましょう!", "empty_column.direct": "ダイレクトメッセージはまだありません。ダイレクトメッセージをやりとりすると、ここに表示されます。", @@ -137,6 +138,13 @@ "getting_started.open_source_notice": "Mastodonはオープンソースソフトウェアです。誰でもGitHub({github})から開発に参加したり、問題を報告したりできます。", "getting_started.security": "セキュリティ", "getting_started.terms": "プライバシーポリシー", + "hashtag.column_header.tag_mode.all": " と {additional}", + "hashtag.column_header.tag_mode.any": " か {additional}", + "hashtag.column_header.tag_mode.none": " ({additional} を除く)", + "hashtag.column_settings.tag_mode.all": "すべてを含む", + "hashtag.column_settings.tag_mode.any": "いずれかを含む", + "hashtag.column_settings.tag_mode.none": "これらを除く", + "hashtag.column_settings.tag_toggle": "このカラムに追加のタグを含める", "home.column_settings.basic": "基本設定", "home.column_settings.show_reblogs": "ブースト表示", "home.column_settings.show_replies": "返信表示", @@ -313,10 +321,11 @@ "status.show_less_all": "全て隠す", "status.show_more": "もっと見る", "status.show_more_all": "全て見る", + "status.show_thread": "続きを読む", "status.unmute_conversation": "会話のミュートを解除", "status.unpin": "プロフィールの固定表示を解除", - "suggestions.dismiss": "Dismiss suggestion", - "suggestions.header": "You might be interested in…", + "suggestions.dismiss": "隠す", + "suggestions.header": "興味あるかもしれません…", "tabs_bar.federated_timeline": "連合", "tabs_bar.home": "ホーム", "tabs_bar.local_timeline": "ローカル", From cc1f13dfd0d9fee7d568918af031f1cd6d1441f4 Mon Sep 17 00:00:00 2001 From: Les Orchard Date: Sun, 11 Nov 2018 17:20:20 -0500 Subject: [PATCH 04/12] Only consider mouse move in scrolling on item insertion (#9262) Fixes #9259 --- app/javascript/mastodon/components/scrollable_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/components/scrollable_list.js b/app/javascript/mastodon/components/scrollable_list.js index 7551d0b1f..ab4e7d59c 100644 --- a/app/javascript/mastodon/components/scrollable_list.js +++ b/app/javascript/mastodon/components/scrollable_list.js @@ -136,7 +136,7 @@ export default class ScrollableList extends PureComponent { React.Children.count(prevProps.children) < React.Children.count(this.props.children) && this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props); - if ((someItemInserted && this.node.scrollTop > 0) || this.mouseMovedRecently) { + if (someItemInserted && (this.node.scrollTop > 0 || this.mouseMovedRecently)) { return this.node.scrollHeight - this.node.scrollTop; } else { return null; From fe57d73e4c9f6a03c8c2d3a680fbd67443d0df77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 12 Nov 2018 12:49:51 +0100 Subject: [PATCH 05/12] Bump bullet from 5.8.1 to 5.9.0 (#9264) Bumps [bullet](https://github.com/flyerhzm/bullet) from 5.8.1 to 5.9.0. - [Release notes](https://github.com/flyerhzm/bullet/releases) - [Changelog](https://github.com/flyerhzm/bullet/blob/master/CHANGELOG.md) - [Commits](https://github.com/flyerhzm/bullet/compare/5.8.1...5.9.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index fb7520369..8982db4ed 100644 --- a/Gemfile +++ b/Gemfile @@ -122,7 +122,7 @@ group :development do gem 'annotate', '~> 2.7' gem 'better_errors', '~> 2.5' gem 'binding_of_caller', '~> 0.7' - gem 'bullet', '~> 5.8' + gem 'bullet', '~> 5.9' gem 'letter_opener', '~> 1.4' gem 'letter_opener_web', '~> 1.3' gem 'memory_profiler' diff --git a/Gemfile.lock b/Gemfile.lock index 0697da1a3..b23fe3d3c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -103,7 +103,7 @@ GEM brakeman (4.3.1) browser (2.5.3) builder (3.2.3) - bullet (5.8.1) + bullet (5.9.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundler-audit (0.6.0) @@ -658,7 +658,7 @@ DEPENDENCIES bootsnap (~> 1.3) brakeman (~> 4.3) browser - bullet (~> 5.8) + bullet (~> 5.9) bundler-audit (~> 0.6) capistrano (~> 3.11) capistrano-rails (~> 1.4) From 111ad866803e2cb411021eba018ad2bf3140fe23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 12 Nov 2018 12:50:12 +0100 Subject: [PATCH 06/12] Bump oj from 3.7.0 to 3.7.1 (#9265) Bumps [oj](https://github.com/ohler55/oj) from 3.7.0 to 3.7.1. - [Release notes](https://github.com/ohler55/oj/releases) - [Changelog](https://github.com/ohler55/oj/blob/master/CHANGELOG.md) - [Commits](https://github.com/ohler55/oj/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b23fe3d3c..150c604f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -359,7 +359,7 @@ GEM concurrent-ruby (~> 1.0.0) sidekiq (>= 3.5.0) statsd-ruby (~> 1.2.0) - oj (3.7.0) + oj (3.7.1) omniauth (1.8.1) hashie (>= 3.4.6, < 3.6.0) rack (>= 1.6.2, < 3) From 971863c42617caadf714b72759191752ce2cd28a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 12 Nov 2018 12:50:21 +0100 Subject: [PATCH 07/12] Bump thor from 0.20.0 to 0.20.3 (#9266) Bumps [thor](https://github.com/wycats/thor) from 0.20.0 to 0.20.3. - [Release notes](https://github.com/wycats/thor/releases) - [Changelog](https://github.com/erikhuda/thor/blob/master/CHANGELOG.md) - [Commits](https://github.com/wycats/thor/compare/v0.20.0...v0.20.3) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 150c604f6..73b7b17a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -594,7 +594,7 @@ GEM unicode-display_width (~> 1.1, >= 1.1.1) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) - thor (0.20.0) + thor (0.20.3) thread_safe (0.3.6) tilt (2.0.8) timers (4.2.0) From c81bdafb074f5ae5bbc27277e8e5141a7f95525f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 12 Nov 2018 12:50:48 +0100 Subject: [PATCH 08/12] Bump parallel_tests from 2.26.2 to 2.27.0 (#9263) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 2.26.2 to 2.27.0. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Commits](https://github.com/grosser/parallel_tests/compare/v2.26.2...v2.27.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 8982db4ed..7f26e5656 100644 --- a/Gemfile +++ b/Gemfile @@ -114,7 +114,7 @@ group :test do gem 'rspec-sidekiq', '~> 3.0' gem 'simplecov', '~> 0.16', require: false gem 'webmock', '~> 3.4' - gem 'parallel_tests', '~> 2.26' + gem 'parallel_tests', '~> 2.27' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 73b7b17a9..e591f660e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -386,7 +386,7 @@ GEM av (~> 0.9.0) paperclip (>= 2.5.2) parallel (1.12.1) - parallel_tests (2.26.2) + parallel_tests (2.27.0) parallel parser (2.5.3.0) ast (~> 2.4.0) @@ -715,7 +715,7 @@ DEPENDENCIES ox (~> 2.10) paperclip (~> 6.0) paperclip-av-transcoder (~> 0.6) - parallel_tests (~> 2.26) + parallel_tests (~> 2.27) pg (~> 1.1) pghero (~> 2.2) pkg-config (~> 1.3) From bbd8fdd185063d8b2464b20ee95c366718b75fc6 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 12 Nov 2018 18:17:50 +0100 Subject: [PATCH 09/12] Perform deep comparison for card data when receiving new props (#9270) Fixes #9226 --- app/javascript/mastodon/features/status/components/card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 743fe779a..3474a11e5 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -73,7 +73,7 @@ export default class Card extends React.PureComponent { }; componentWillReceiveProps (nextProps) { - if (this.props.card !== nextProps.card) { + if (!this.props.card.equals(nextProps.card)) { this.setState({ embedded: false }); } } From bb69d154c43da667d5768e2707d2240c60b7346a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 12 Nov 2018 22:07:31 +0100 Subject: [PATCH 10/12] Fix null error introduced in #9270 (#9275) --- app/javascript/mastodon/features/status/components/card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 3474a11e5..235d209b8 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -73,7 +73,7 @@ export default class Card extends React.PureComponent { }; componentWillReceiveProps (nextProps) { - if (!this.props.card.equals(nextProps.card)) { + if (!Immutable.is(this.props.card, nextProps.card)) { this.setState({ embedded: false }); } } From c875f19673e923e7a6e3c2b6656e96b863ca5915 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 13 Nov 2018 14:58:14 +0100 Subject: [PATCH 11/12] Fix race condition causing shallow status with only a "favourited" attribute (#9272) Fixes #9231 --- app/javascript/mastodon/reducers/statuses.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/mastodon/reducers/statuses.js index 6e3d830da..885cc221c 100644 --- a/app/javascript/mastodon/reducers/statuses.js +++ b/app/javascript/mastodon/reducers/statuses.js @@ -38,11 +38,11 @@ export default function statuses(state = initialState, action) { case FAVOURITE_REQUEST: return state.setIn([action.status.get('id'), 'favourited'], true); case FAVOURITE_FAIL: - return state.setIn([action.status.get('id'), 'favourited'], false); + return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false); case REBLOG_REQUEST: return state.setIn([action.status.get('id'), 'reblogged'], true); case REBLOG_FAIL: - return state.setIn([action.status.get('id'), 'reblogged'], false); + return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false); case STATUS_MUTE_SUCCESS: return state.setIn([action.id, 'muted'], true); case STATUS_UNMUTE_SUCCESS: From 6ce7e74b46d47863f95f1fe3209437e24a4644b7 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 13 Nov 2018 16:30:07 +0100 Subject: [PATCH 12/12] [Glitch] Fix race condition when interacting with deleted toots Port c875f19673e923e7a6e3c2b6656e96b863ca5915 to glitch-soc --- app/javascript/flavours/glitch/reducers/statuses.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/reducers/statuses.js b/app/javascript/flavours/glitch/reducers/statuses.js index 617d96e5d..1beaf73e1 100644 --- a/app/javascript/flavours/glitch/reducers/statuses.js +++ b/app/javascript/flavours/glitch/reducers/statuses.js @@ -118,15 +118,15 @@ export default function statuses(state = initialState, action) { case FAVOURITE_REQUEST: return state.setIn([action.status.get('id'), 'favourited'], true); case FAVOURITE_FAIL: - return state.setIn([action.status.get('id'), 'favourited'], false); + return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false); case BOOKMARK_REQUEST: return state.setIn([action.status.get('id'), 'bookmarked'], true); case BOOKMARK_FAIL: - return state.setIn([action.status.get('id'), 'bookmarked'], false); + return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false); case REBLOG_REQUEST: return state.setIn([action.status.get('id'), 'reblogged'], true); case REBLOG_FAIL: - return state.setIn([action.status.get('id'), 'reblogged'], false); + return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false); case STATUS_MUTE_SUCCESS: return state.setIn([action.id, 'muted'], true); case STATUS_UNMUTE_SUCCESS: