From: Thibaut Girka Date: Sun, 30 Aug 2020 14:13:08 +0000 (+0200) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=8c3c27bf063d648823da39a206be3efd285611ad;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - `app/controllers/accounts_controller.rb`: Upstream change too close to a glitch-soc change related to instance-local toots. Merged upstream changes. - `app/services/fan_out_on_write_service.rb`: Minor conflict due to glitch-soc's handling of Direct Messages, merged upstream changes. - `yarn.lock`: Not really a conflict, caused by glitch-soc-only dependencies being textually too close to updated upstream dependencies. Merged upstream changes. --- 8c3c27bf063d648823da39a206be3efd285611ad diff --cc Gemfile.lock index e023ca5f8,bf47faabe..a16cacc70 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -747,9 -773,8 +774,9 @@@ DEPENDENCIE rails-i18n (~> 5.1) rails-settings-cached (~> 0.6) rdf-normalize (~> 0.4) + redcarpet (~> 3.4) redis (~> 4.2) - redis-namespace (~> 1.7) + redis-namespace (~> 1.8) redis-rails (~> 5.0) rqrcode (~> 1.1) rspec-rails (~> 4.0) diff --cc app/controllers/accounts_controller.rb index 5c8cdd174,d97d88fd9..54106933c --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@@ -28,9 -27,8 +28,8 @@@ class AccountsController < ApplicationC return end - @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses? + @pinned_statuses = cache_collection(@account.pinned_statuses.not_local_only, Status) if show_pinned_statuses? - @statuses = filtered_status_page - @statuses = cache_collection(@statuses, Status) + @statuses = cached_filtered_status_page @rss_url = rss_url unless @statuses.empty? diff --cc app/controllers/api/v1/timelines/public_controller.rb index b449bcadf,26d877b00..52b5cb323 --- a/app/controllers/api/v1/timelines/public_controller.rb +++ b/app/controllers/api/v1/timelines/public_controller.rb @@@ -28,13 -26,13 +26,15 @@@ class Api::V1::Timelines::PublicControl limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id) ) + end + + def public_statuses + statuses = public_timeline_statuses + statuses = statuses.not_local_only unless truthy_param?(:local) || truthy_param?(:allow_local_only) + if truthy_param?(:only_media) - # `SELECT DISTINCT id, updated_at` is too slow, so pluck ids at first, and then select id, updated_at with ids. - status_ids = statuses.joins(:media_attachments).distinct(:id).pluck(:id) - statuses.where(id: status_ids) + statuses.joins(:media_attachments).group(:id) else statuses end diff --cc app/controllers/concerns/two_factor_authentication_concern.rb index 35c0c27cf,8a2a86a02..6b043a804 --- a/app/controllers/concerns/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/two_factor_authentication_concern.rb @@@ -42,8 -73,13 +73,14 @@@ module TwoFactorAuthenticationConcer def prompt_for_two_factor(user) set_locale do session[:attempt_user_id] = user.id + use_pack 'auth' @body_classes = 'lighter' + @webauthn_enabled = user.webauthn_enabled? + @scheme_type = if user.webauthn_enabled? && user_params[:otp_attempt].blank? + 'webauthn' + else + 'totp' + end render :two_factor end end diff --cc app/lib/activitypub/activity/create.rb index f09caaae4,f275feefc..3a9f83978 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@@ -352,14 -352,12 +352,14 @@@ class ActivityPub::Activity::Create < A end def visibility_from_audience - if equals_or_includes?(audience_to, ActivityPub::TagManager::COLLECTIONS[:public]) + if audience_to.include?(ActivityPub::TagManager::COLLECTIONS[:public]) :public - elsif equals_or_includes?(audience_cc, ActivityPub::TagManager::COLLECTIONS[:public]) + elsif audience_cc.include?(ActivityPub::TagManager::COLLECTIONS[:public]) :unlisted - elsif equals_or_includes?(audience_to, @account.followers_url) + elsif audience_to.include?(@account.followers_url) :private + elsif direct_message == false + :limited else :direct end @@@ -367,13 -365,9 +367,13 @@@ def audience_includes?(account) uri = ActivityPub::TagManager.instance.uri_for(account) - equals_or_includes?(audience_to, uri) || equals_or_includes?(audience_cc, uri) + audience_to.include?(uri) || audience_cc.include?(uri) end + def direct_message + @object['directMessage'] + end + def replied_to_status return @replied_to_status if defined?(@replied_to_status) diff --cc app/services/fan_out_on_write_service.rb index dd9c1264d,21931c2f1..5f3feeed9 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@@ -6,13 -6,7 +6,11 @@@ class FanOutOnWriteService < BaseServic def call(status) raise Mastodon::RaceConditionError if status.visibility.nil? + deliver_to_self(status) if status.account.local? + - render_anonymous_payload(status) - if status.direct_visibility? + deliver_to_mentioned_followers(status) + deliver_to_direct_timelines(status) deliver_to_own_conversation(status) elsif status.limited_visibility? deliver_to_mentioned_followers(status) @@@ -21,12 -16,13 +19,14 @@@ deliver_to_lists(status) end - return if status.account.silenced? || !status.public_visibility? || status.reblog? + return if status.account.silenced? || !status.public_visibility? + return if status.reblog? && !Setting.show_reblogs_in_public_timelines + render_anonymous_payload(status) + deliver_to_hashtags(status) - return if status.reply? && status.in_reply_to_account_id != status.account_id + return if status.reply? && status.in_reply_to_account_id != status.account_id && !Setting.show_replies_in_public_timelines deliver_to_public(status) deliver_to_media(status) if status.media_attachments.any? diff --cc package.json index 846828647,078ce1fc9..658944c7e --- a/package.json +++ b/package.json @@@ -64,17 -63,17 +64,18 @@@ "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-transform-react-inline-elements": "^7.10.4", - "@babel/plugin-transform-runtime": "^7.10.5", + "@babel/plugin-transform-runtime": "^7.11.0", "@babel/preset-env": "^7.11.0", "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.8.4", - "@clusterws/cws": "^2.0.0", + "@babel/runtime": "^7.11.2", + "@clusterws/cws": "^3.0.0", "@gamestdio/websocket": "^0.3.2", + "@github/webauthn-json": "^0.4.2", "@rails/ujs": "^6.0.3", "array-includes": "^3.1.1", + "atrament": "0.2.4", "arrow-key-navigation": "^1.2.0", - "autoprefixer": "^9.8.5", + "autoprefixer": "^9.8.6", "axios": "^0.19.2", "babel-loader": "^8.1.0", "babel-plugin-lodash": "^3.3.4", diff --cc yarn.lock index 6f0c4e058,52805ef9b..bc58b51ca --- a/yarn.lock +++ b/yarn.lock @@@ -2086,19 -2105,14 +2105,19 @@@ atob@^2.1.2 resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +atrament@0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/atrament/-/atrament-0.2.4.tgz#6f78196edfcd194e568b7c0b9c88201ec371ac66" + integrity sha512-hSA9VwW6COMwvRhSEO4uZweZ91YGOdHqwvslNyrJZG+8mzc4qx/qMsDZBuAeXFeWZO/QKtRjIXguOUy1aNMl3A== + - autoprefixer@^9.8.5: - version "9.8.5" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.5.tgz#2c225de229ddafe1d1424c02791d0c3e10ccccaa" - integrity sha512-C2p5KkumJlsTHoNv9w31NrBRgXhf6eCMteJuHZi2xhkgC+5Vm40MEtCKPhc0qdgAOhox0YPy1SQHTAky05UoKg== + autoprefixer@^9.8.6: + version "9.8.6" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f" + integrity sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg== dependencies: browserslist "^4.12.0" - caniuse-lite "^1.0.30001097" - colorette "^1.2.0" + caniuse-lite "^1.0.30001109" + colorette "^1.2.1" normalize-range "^0.1.2" num2fraction "^1.2.2" postcss "^7.0.32"