From 4bcef12bad8f554f3b0fc2fc34b7d4ca4cc567db Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 11 May 2020 01:09:21 +0200 Subject: Fix sr locale being selected over sr-Latn (#13693) * Fix sr locale being selected over sr-Latn * Update tests --- app/controllers/concerns/localized.rb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'app') diff --git a/app/controllers/concerns/localized.rb b/app/controllers/concerns/localized.rb index b43859d9d..d1384ed56 100644 --- a/app/controllers/concerns/localized.rb +++ b/app/controllers/concerns/localized.rb @@ -28,18 +28,6 @@ module Localized end def request_locale - preferred_locale || compatible_locale - end - - def preferred_locale - http_accept_language.preferred_language_from(available_locales) - end - - def compatible_locale - http_accept_language.compatible_language_from(available_locales) - end - - def available_locales - I18n.available_locales.reverse + http_accept_language.language_region_compatible_from(I18n.available_locales) end end -- cgit From d8bad8fbf6af52503d9a29da6ce36148e77b9f1b Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Tue, 12 May 2020 22:24:35 +0900 Subject: Fix not publishing update of remote timeline (#13745) * Fix not publishing update of remote timeline * fix @ missing * if/unless to if/else --- app/services/batched_remove_status_service.rb | 13 ++++++++++--- app/services/fan_out_on_write_service.rb | 12 ++++++++++-- app/services/remove_status_service.rb | 12 ++++++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index 3638134be..2295a01dc 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -72,11 +72,18 @@ class BatchedRemoveStatusService < BaseService redis.pipelined do redis.publish('timeline:public', payload) - redis.publish('timeline:public:local', payload) if status.local? - + if status.local? + redis.publish('timeline:public:local', payload) + else + redis.publish('timeline:public:remote', payload) + end if status.media_attachments.any? redis.publish('timeline:public:media', payload) - redis.publish('timeline:public:local:media', payload) if status.local? + if status.local? + redis.publish('timeline:public:local:media', payload) + else + redis.publish('timeline:public:remote:media', payload) + end end @tags[status.id].each do |hashtag| diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 95336ef45..276eac0c1 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -81,14 +81,22 @@ class FanOutOnWriteService < BaseService Rails.logger.debug "Delivering status #{status.id} to public timeline" Redis.current.publish('timeline:public', @payload) - Redis.current.publish('timeline:public:local', @payload) if status.local? + if status.local? + Redis.current.publish('timeline:public:local', @payload) + else + Redis.current.publish('timeline:public:remote', @payload) + end end def deliver_to_media(status) Rails.logger.debug "Delivering status #{status.id} to media timeline" Redis.current.publish('timeline:public:media', @payload) - Redis.current.publish('timeline:public:local:media', @payload) if status.local? + if status.local? + Redis.current.publish('timeline:public:local:media', @payload) + else + Redis.current.publish('timeline:public:remote:media', @payload) + end end def deliver_to_own_conversation(status) diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index f9352ed3d..4f0edc3cf 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -140,14 +140,22 @@ class RemoveStatusService < BaseService return unless @status.public_visibility? redis.publish('timeline:public', @payload) - redis.publish('timeline:public:local', @payload) if @status.local? + if @status.local? + redis.publish('timeline:public:local', @payload) + else + redis.publish('timeline:public:remote', @payload) + end end def remove_from_media return unless @status.public_visibility? redis.publish('timeline:public:media', @payload) - redis.publish('timeline:public:local:media', @payload) if @status.local? + if @status.local? + redis.publish('timeline:public:local:media', @payload) + else + redis.publish('timeline:public:remote:media', @payload) + end end def remove_media -- cgit From 78202e9138bd605c76d19d5b9d7121d1ae6b5e06 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 12 May 2020 15:25:33 +0200 Subject: Bump doorkeeper from 5.3.3 to 5.4.0 (#13733) * Bump doorkeeper from 5.3.3 to 5.4.0 Bumps [doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) from 5.3.3 to 5.4.0. - [Release notes](https://github.com/doorkeeper-gem/doorkeeper/releases) - [Changelog](https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md) - [Commits](https://github.com/doorkeeper-gem/doorkeeper/compare/v5.3.3...v5.4.0) Signed-off-by: dependabot-preview[bot] * Fix tests * Fix use of Doorkeeper::AccessToken.find_or_create_for * Fix tests? Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Thibaut Girka --- Gemfile | 2 +- Gemfile.lock | 4 ++-- app/models/web/push_subscription.rb | 10 +++++----- spec/controllers/api/v1/accounts_controller_spec.rb | 2 +- spec/controllers/oauth/authorizations_controller_spec.rb | 10 +++++----- spec/controllers/oauth/tokens_controller_spec.rb | 5 +++-- 6 files changed, 17 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/Gemfile b/Gemfile index 890b0ee97..3150c368d 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,7 @@ gem 'omniauth-saml', '~> 1.10' gem 'omniauth', '~> 1.9' gem 'discard', '~> 1.2' -gem 'doorkeeper', '~> 5.3' +gem 'doorkeeper', '~> 5.4' gem 'fast_blank', '~> 1.0' gem 'fastimage' gem 'goldfinger', '~> 2.1' diff --git a/Gemfile.lock b/Gemfile.lock index 899624064..accac821b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -194,7 +194,7 @@ GEM docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.3.3) + doorkeeper (5.4.0) railties (>= 5) dotenv (2.7.5) dotenv-rails (2.7.5) @@ -697,7 +697,7 @@ DEPENDENCIES devise-two-factor (~> 3.1) devise_pam_authenticatable2 (~> 9.2) discard (~> 1.2) - doorkeeper (~> 5.3) + doorkeeper (~> 5.4) dotenv-rails (~> 2.7) e2mmap (~> 0.1.0) fabrication (~> 2.21) diff --git a/app/models/web/push_subscription.rb b/app/models/web/push_subscription.rb index c5dbb58ba..c407a7789 100644 --- a/app/models/web/push_subscription.rb +++ b/app/models/web/push_subscription.rb @@ -94,11 +94,11 @@ class Web::PushSubscription < ApplicationRecord def find_or_create_access_token Doorkeeper::AccessToken.find_or_create_for( - Doorkeeper::Application.find_by(superapp: true), - session_activation.user_id, - Doorkeeper::OAuth::Scopes.from_string('read write follow push'), - Doorkeeper.configuration.access_token_expires_in, - Doorkeeper.configuration.refresh_token_enabled? + application: Doorkeeper::Application.find_by(superapp: true), + resource_owner: session_activation.user_id, + scopes: Doorkeeper::OAuth::Scopes.from_string('read write follow push'), + expires_in: Doorkeeper.configuration.access_token_expires_in, + use_refresh_token: Doorkeeper.configuration.refresh_token_enabled? ) end end diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb index f5f65c000..024409dab 100644 --- a/spec/controllers/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts_controller_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do describe 'POST #create' do let(:app) { Fabricate(:application) } - let(:token) { Doorkeeper::AccessToken.find_or_create_for(app, nil, 'read write', nil, false) } + let(:token) { Doorkeeper::AccessToken.find_or_create_for(application: app, resource_owner: nil, scopes: 'read write', use_refresh_token: false) } let(:agreement) { nil } before do diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb index a84260a54..c5eeea397 100644 --- a/spec/controllers/oauth/authorizations_controller_spec.rb +++ b/spec/controllers/oauth/authorizations_controller_spec.rb @@ -41,11 +41,11 @@ RSpec.describe Oauth::AuthorizationsController, type: :controller do context 'when app is already authorized' do before do Doorkeeper::AccessToken.find_or_create_for( - app, - user.id, - app.scopes, - Doorkeeper.configuration.access_token_expires_in, - Doorkeeper.configuration.refresh_token_enabled? + application: app, + resource_owner: user.id, + scopes: app.scopes, + expires_in: Doorkeeper.configuration.access_token_expires_in, + use_refresh_token: Doorkeeper.configuration.refresh_token_enabled? ) end diff --git a/spec/controllers/oauth/tokens_controller_spec.rb b/spec/controllers/oauth/tokens_controller_spec.rb index ba8e367a6..3804e035b 100644 --- a/spec/controllers/oauth/tokens_controller_spec.rb +++ b/spec/controllers/oauth/tokens_controller_spec.rb @@ -5,11 +5,12 @@ require 'rails_helper' RSpec.describe Oauth::TokensController, type: :controller do describe 'POST #revoke' do let!(:user) { Fabricate(:user) } - let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) } + let!(:application) { Fabricate(:application, confidential: false) } + let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: application) } let!(:web_push_subscription) { Fabricate(:web_push_subscription, user: user, access_token: access_token) } before do - post :revoke, params: { token: access_token.token } + post :revoke, params: { client_id: application.uid, token: access_token.token } end it 'revokes the token' do -- cgit From 5daae6dc610bad24eb0030cfaf124930a34805b1 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Tue, 12 May 2020 22:28:29 +0900 Subject: Fix keybase config serializer (#13742) --- app/javascript/images/logo_transparent_white.svg | 1 + app/lib/proof_provider/keybase/config_serializer.rb | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 app/javascript/images/logo_transparent_white.svg (limited to 'app') diff --git a/app/javascript/images/logo_transparent_white.svg b/app/javascript/images/logo_transparent_white.svg new file mode 100644 index 000000000..f061ffe4c --- /dev/null +++ b/app/javascript/images/logo_transparent_white.svg @@ -0,0 +1 @@ + diff --git a/app/lib/proof_provider/keybase/config_serializer.rb b/app/lib/proof_provider/keybase/config_serializer.rb index 2840f1823..fbce7aeee 100644 --- a/app/lib/proof_provider/keybase/config_serializer.rb +++ b/app/lib/proof_provider/keybase/config_serializer.rb @@ -22,7 +22,12 @@ class ProofProvider::Keybase::ConfigSerializer < ActiveModel::Serializer end def logo - { svg_black: full_asset_url(asset_pack_path('media/images/logo_transparent_black.svg')), svg_full: full_asset_url(asset_pack_path('media/images/logo.svg')) } + { + svg_black: full_asset_url(asset_pack_path('media/images/logo_transparent_black.svg')), + svg_white: full_asset_url(asset_pack_path('media/images/logo_transparent_white.svg')), + svg_full: full_asset_url(asset_pack_path('media/images/logo.svg')), + svg_full_darkmode: full_asset_url(asset_pack_path('media/images/logo.svg')), + } end def brand_color -- cgit From af6d35627978047724612c027e60cb0a89cb2eef Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 12 May 2020 15:29:44 +0200 Subject: Fix first poll option not being focused when adding a poll (#13740) Fixes #13698 --- app/javascript/mastodon/features/compose/components/poll_form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index 2f37ce64b..db49f90eb 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -27,6 +27,7 @@ class Option extends React.PureComponent { title: PropTypes.string.isRequired, index: PropTypes.number.isRequired, isPollMultiple: PropTypes.bool, + autoFocus: PropTypes.bool, onChange: PropTypes.func.isRequired, onRemove: PropTypes.func.isRequired, onToggleMultiple: PropTypes.func.isRequired, @@ -71,7 +72,7 @@ class Option extends React.PureComponent { } render () { - const { isPollMultiple, title, index, intl } = this.props; + const { isPollMultiple, title, index, autoFocus, intl } = this.props; return (
  • @@ -96,6 +97,7 @@ class Option extends React.PureComponent { onSuggestionsClearRequested={this.onSuggestionsClearRequested} onSuggestionSelected={this.onSuggestionSelected} searchTokens={[':']} + autoFocus={autoFocus} /> @@ -146,10 +148,12 @@ class PollForm extends ImmutablePureComponent { return null; } + const autoFocusIndex = options.indexOf(''); + return (
      - {options.map((title, i) =>
    -- cgit From 706972b4bab8c5a0a28f66ebf91716786f1e2690 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Tue, 12 May 2020 22:55:25 +0900 Subject: Fix RedownloadMediaWorker (#13741) --- app/workers/redownload_media_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/workers/redownload_media_worker.rb b/app/workers/redownload_media_worker.rb index 98e995918..071501a49 100644 --- a/app/workers/redownload_media_worker.rb +++ b/app/workers/redownload_media_worker.rb @@ -11,7 +11,7 @@ class RedownloadMediaWorker return if media_attachment.remote_url.blank? - media_attachment.reset_file! + media_attachment.file_remote_url = media_attachment.remote_url media_attachment.save rescue ActiveRecord::RecordNotFound true -- cgit From 48503384d00525fe61a038bdb8a55868fdc1db92 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 13 May 2020 21:20:34 +0200 Subject: Fix some account avatars on public pages having incorrect size (#13692) * Fix some account avatars on public pages having incorrect size * Remove outdated and overridden width and height attributes * Remove more hardcoded width/height attributes --- app/javascript/styles/mastodon/statuses.scss | 5 +++++ app/views/about/show.html.haml | 2 +- app/views/directories/index.html.haml | 2 +- app/views/statuses/_detailed_status.html.haml | 4 ++-- app/views/statuses/_simple_status.html.haml | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/javascript/styles/mastodon/statuses.scss b/app/javascript/styles/mastodon/statuses.scss index 0b7be7afd..a8fd2936c 100644 --- a/app/javascript/styles/mastodon/statuses.scss +++ b/app/javascript/styles/mastodon/statuses.scss @@ -149,6 +149,11 @@ &__avatar { left: 15px; top: 17px; + + .account__avatar { + width: 48px; + height: 48px; + } } &__content { diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index 07e06100a..565c4ed59 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -27,7 +27,7 @@ .avatar-stack - @instance_presenter.sample_accounts.each do |account| - = image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar' + = image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, alt: '', class: 'account__avatar' - if Setting.timeline_preview .directory__tag diff --git a/app/views/directories/index.html.haml b/app/views/directories/index.html.haml index bdc1e9d5a..7975ee999 100644 --- a/app/views/directories/index.html.haml +++ b/app/views/directories/index.html.haml @@ -25,7 +25,7 @@ .directory__card__bar = link_to TagManager.instance.url_for(account), class: 'directory__card__bar__name' do .avatar - = image_tag account.avatar.url, alt: '', width: 48, height: 48, class: 'u-photo' + = image_tag account.avatar.url, alt: '', class: 'u-photo' .display-name %bdi diff --git a/app/views/statuses/_detailed_status.html.haml b/app/views/statuses/_detailed_status.html.haml index 544b92330..33b81c748 100644 --- a/app/views/statuses/_detailed_status.html.haml +++ b/app/views/statuses/_detailed_status.html.haml @@ -3,9 +3,9 @@ = link_to ActivityPub::TagManager.instance.url_for(status.account), class: 'detailed-status__display-name u-url', target: stream_link_target, rel: 'noopener' do .detailed-status__display-avatar - if current_account&.user&.setting_auto_play_gif || autoplay - = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' + = image_tag status.account.avatar_original_url, alt: '', class: 'account__avatar u-photo' - else - = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' + = image_tag status.account.avatar_static_url, alt: '', class: 'account__avatar u-photo' %span.display-name %bdi %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) diff --git a/app/views/statuses/_simple_status.html.haml b/app/views/statuses/_simple_status.html.haml index ff09ab2ee..d7853eca9 100644 --- a/app/views/statuses/_simple_status.html.haml +++ b/app/views/statuses/_simple_status.html.haml @@ -9,9 +9,9 @@ .status__avatar %div - if current_account&.user&.setting_auto_play_gif || autoplay - = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' + = image_tag status.account.avatar_original_url, alt: '', class: 'u-photo account__avatar' - else - = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' + = image_tag status.account.avatar_static_url, alt: '', class: 'u-photo account__avatar' %span.display-name %bdi %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) -- cgit From 92f85bea528c5eca97a2f075c53f7dcafdf5cb41 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 13 May 2020 21:20:45 +0200 Subject: Change “hide/show boosts from …” menu to be hidden when the account is muted (#13748) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, it may mislead users into believing this setting is an exception to the muting behavior. Fixes #13744 --- app/javascript/mastodon/features/account/components/header.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js index 92780a70b..8c85bbc39 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/mastodon/features/account/components/header.js @@ -192,10 +192,12 @@ class Header extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' }); } else { if (account.getIn(['relationship', 'following'])) { - if (account.getIn(['relationship', 'showing_reblogs'])) { - menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); - } else { - menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); + if (!account.getIn(['relationship', 'muting'])) { + if (account.getIn(['relationship', 'showing_reblogs'])) { + menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); + } else { + menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); + } } menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle }); -- cgit