From 473abc35a19771304839dc57dc41ef309a826658 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 23 Dec 2020 07:47:03 +0100 Subject: [PATCH 01/87] Fix trying to privatize empty media attachments (#15414) --- app/services/suspend_account_service.rb | 2 ++ app/services/unsuspend_account_service.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 19d65280d9..22e5197086 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -65,6 +65,8 @@ class SuspendAccountService < BaseService attachment = media_attachment.public_send(attachment_name) styles = [:original] | attachment.styles.keys + next if attachment.blank? + styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb index f07a3f053b..be7ad9df3e 100644 --- a/app/services/unsuspend_account_service.rb +++ b/app/services/unsuspend_account_service.rb @@ -56,6 +56,8 @@ class UnsuspendAccountService < BaseService attachment = media_attachment.public_send(attachment_name) styles = [:original] | attachment.styles.keys + next if attachment.blank? + styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 From de57efd055c8c6af9e6e2aa450cea790546aabbc Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 23 Dec 2020 16:43:11 +0100 Subject: [PATCH 02/87] Fix mentions not being deleted efficiently (#15416) As a regression from the recent optimizations, mentions were left untouched until `account.destroy`, which would then delete them individually, and executing queries to find and delete associated notifications, resulting in a massive slowdown. Co-authored-by: Claire --- app/services/delete_account_service.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 2bb533cfb6..f8154cc3eb 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -142,6 +142,7 @@ class DeleteAccountService < BaseService purge_user! purge_profile! purge_statuses! + purge_mentions! purge_media_attachments! purge_polls! purge_generated_notifications! @@ -159,6 +160,10 @@ class DeleteAccountService < BaseService end end + def purge_mentions! + @account.mentions.reorder(nil).where.not(status_id: reported_status_ids).in_batches.delete_all + end + def purge_media_attachments! @account.media_attachments.reorder(nil).find_each do |media_attachment| next if keep_account_record? && reported_status_ids.include?(media_attachment.status_id) From 4950e59cdcd59a181238d3d504398de188e19319 Mon Sep 17 00:00:00 2001 From: trwnh Date: Wed, 23 Dec 2020 09:43:38 -0600 Subject: [PATCH 03/87] Use existing FeaturedTag serializer and delete AccountFeaturedTag serializer (#15415) * Update featured_tags_controller.rb * Update featured_tag_serializer.rb * Update featured_tag_serializer.rb * Delete account_featured_tag_serializer.rb * please codeclimate * please codeclimate --- .../api/v1/accounts/featured_tags_controller.rb | 2 +- .../rest/account_featured_tag_serializer.rb | 15 --------------- app/serializers/rest/featured_tag_serializer.rb | 8 +++++++- 3 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 app/serializers/rest/account_featured_tag_serializer.rb diff --git a/app/controllers/api/v1/accounts/featured_tags_controller.rb b/app/controllers/api/v1/accounts/featured_tags_controller.rb index dc01b577c1..0101fb469b 100644 --- a/app/controllers/api/v1/accounts/featured_tags_controller.rb +++ b/app/controllers/api/v1/accounts/featured_tags_controller.rb @@ -7,7 +7,7 @@ class Api::V1::Accounts::FeaturedTagsController < Api::BaseController respond_to :json def index - render json: @featured_tags, each_serializer: REST::AccountFeaturedTagSerializer + render json: @featured_tags, each_serializer: REST::FeaturedTagSerializer end private diff --git a/app/serializers/rest/account_featured_tag_serializer.rb b/app/serializers/rest/account_featured_tag_serializer.rb deleted file mode 100644 index 84bef2e629..0000000000 --- a/app/serializers/rest/account_featured_tag_serializer.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class REST::AccountFeaturedTagSerializer < ActiveModel::Serializer - include RoutingHelper - - attributes :id, :name, :url - - def id - object.tag.id.to_s - end - - def url - short_account_tag_url(object.account, object.tag) - end -end diff --git a/app/serializers/rest/featured_tag_serializer.rb b/app/serializers/rest/featured_tag_serializer.rb index 08121ff16d..96adcc7d09 100644 --- a/app/serializers/rest/featured_tag_serializer.rb +++ b/app/serializers/rest/featured_tag_serializer.rb @@ -1,9 +1,15 @@ # frozen_string_literal: true class REST::FeaturedTagSerializer < ActiveModel::Serializer - attributes :id, :name, :statuses_count, :last_status_at + include RoutingHelper + + attributes :id, :name, :url, :statuses_count, :last_status_at def id object.id.to_s end + + def url + short_account_tag_url(object.account, object.tag) + end end From b08d2d4f78e143189c0dc3470a8dc186bf441419 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 23 Dec 2020 19:55:23 +0100 Subject: [PATCH 04/87] Fix media modal buttons not showing up on mobile (#15417) Fixes #15374 When the pop-out player was introduced, it had tweaks for the mobile view, but it's now disabled in mobile mode and the styling was reused for modals, causing the footer to be hidden on mobile without a good reason. Co-authored-by: Claire --- app/javascript/styles/mastodon/components.scss | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 2163d74fc4..c248f681ef 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -7194,21 +7194,6 @@ noscript { .audio-player { border-radius: 0; } - - @media screen and (max-width: 415px) { - width: 210px; - bottom: 10px; - right: 10px; - - &__footer { - display: none; - } - - .video-player, - .audio-player { - border-radius: 0 0 4px 4px; - } - } } .picture-in-picture-placeholder { From 7e6d3a7d9ad3343c7147032fef50bf1cc308a872 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Thu, 24 Dec 2020 07:47:50 +0900 Subject: [PATCH 05/87] Fix unfollow action button style (#15418) --- app/javascript/mastodon/features/account/components/header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js index 2b97af4e67..c8fd85e1d9 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/mastodon/features/account/components/header.js @@ -170,7 +170,7 @@ class Header extends ImmutablePureComponent { } else if (account.getIn(['relationship', 'requested'])) { actionBtn = @@ -95,13 +53,6 @@ exports[` diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/mastodon/components/button.js index eb8dd7dc8e..85b2d78ca9 100644 --- a/app/javascript/mastodon/components/button.js +++ b/app/javascript/mastodon/components/button.js @@ -10,17 +10,11 @@ export default class Button extends React.PureComponent { disabled: PropTypes.bool, block: PropTypes.bool, secondary: PropTypes.bool, - size: PropTypes.number, className: PropTypes.string, title: PropTypes.string, - style: PropTypes.object, children: PropTypes.node, }; - static defaultProps = { - size: 36, - }; - handleClick = (e) => { if (!this.props.disabled) { this.props.onClick(e); @@ -36,13 +30,6 @@ export default class Button extends React.PureComponent { } render () { - const style = { - padding: `0 ${this.props.size / 2.25}px`, - height: `${this.props.size}px`, - lineHeight: `${this.props.size}px`, - ...this.props.style, - }; - const className = classNames('button', this.props.className, { 'button-secondary': this.props.secondary, 'button--block': this.props.block, @@ -54,7 +41,6 @@ export default class Button extends React.PureComponent { disabled={this.props.disabled} onClick={this.handleClick} ref={this.setRef} - style={style} title={this.props.title} > {this.props.text || this.props.children} diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js index c8fd85e1d9..b47ebed62e 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/mastodon/features/account/components/header.js @@ -164,13 +164,17 @@ class Header extends ImmutablePureComponent { info.push(); } + if (account.getIn(['relationship', 'requested']) || account.getIn(['relationship', 'following'])) { + bellBtn = ; + } + if (me !== account.get('id')) { if (!account.get('relationship')) { // Wait until the relationship is loaded actionBtn = ''; } else if (account.getIn(['relationship', 'requested'])) { - actionBtn =