]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'master' into glitch-soc/merge-upstream
authorThibaut Girka <thib@sitedethib.com>
Mon, 28 Sep 2020 12:13:30 +0000 (14:13 +0200)
committerThibaut Girka <thib@sitedethib.com>
Mon, 28 Sep 2020 12:13:30 +0000 (14:13 +0200)
Conflicts:
- `Gemfile.lock`:
  Not a real conflict, upstream updated dependencies that were too close to
  glitch-soc-only ones in the file.
- `app/controllers/oauth/authorized_applications_controller.rb`:
  Upstream changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's theming system.
  Ported upstream changes.
- `app/controllers/settings/base_controller.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's theming system.
  Ported upstream changes.
- `app/controllers/settings/sessions_controller.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's theming system.
  Ported upstream changes.
- `app/models/user.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc not preventing moved accounts from logging
  in.
  Ported upstream changes while keeping the ability for moved accounts to log
  in.
- `app/policies/status_policy.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's local-only toots.
  Ported upstream changes.
- `app/serializers/rest/account_serializer.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's ability  to hide followers count.
  Ported upstream changes.
- `app/services/process_mentions_service.rb`:
  Upstream refactored and changed the logic surrounding suspended accounts.
  Minor conflict due to glitch-soc's local-only toots.
  Ported upstream changes.
- `package.json`:
  Not a real conflict, upstream updated dependencies that were too close to
  glitch-soc-only ones in the file.

29 files changed:
1  2 
Gemfile
Gemfile.lock
app/controllers/accounts_controller.rb
app/controllers/api/v1/mutes_controller.rb
app/controllers/api/v1/notifications_controller.rb
app/controllers/oauth/authorized_applications_controller.rb
app/controllers/settings/base_controller.rb
app/controllers/settings/identity_proofs_controller.rb
app/controllers/settings/preferences_controller.rb
app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb
app/javascript/styles/mastodon/components.scss
app/models/account.rb
app/models/status.rb
app/models/tag_feed.rb
app/models/user.rb
app/policies/status_policy.rb
app/serializers/rest/account_serializer.rb
app/services/process_mentions_service.rb
app/services/reblog_service.rb
app/workers/feed_insert_worker.rb
config/navigation.rb
config/routes.rb
db/schema.rb
package.json
spec/models/concerns/account_interactions_spec.rb
spec/models/follow_request_spec.rb
spec/services/notify_service_spec.rb
streaming/index.js
yarn.lock

diff --cc Gemfile
Simple merge
diff --cc Gemfile.lock
index 581d494ab6de5bb81b70ab84fa7eb9fa4b456b33,cdbb310c46a29fe7041be074e0862fe1b9696a43..6f9c6a6f9019863315fb9d2de64f576e4ecad9e2
@@@ -481,8 -480,7 +480,8 @@@ GE
        link_header (~> 0.0, >= 0.0.8)
      rdf-normalize (0.4.0)
        rdf (~> 3.1)
-     redis (4.2.1)
 +    redcarpet (3.5.0)
+     redis (4.2.2)
      redis-actionpack (5.2.0)
        actionpack (>= 5, < 7)
        redis-rack (>= 2.1.0, < 3)
index 5dc047b43d3378f8c72d6ebcd22479c23f6e0d93,805d0dee2abcb5211ca09c940d78aaa63291635a..a89f3d7002ca5f169dc427bc66e0ac288c773a7a
@@@ -21,12 -16,10 +21,14 @@@ class Api::V1::MutesController < Api::B
      paginated_mutes.map(&:target_account)
    end
  
 +  def load_mutes
 +    paginated_mutes.includes(:account, :target_account).to_a
 +  end
 +
    def paginated_mutes
      @paginated_mutes ||= Mute.eager_load(:target_account)
+                              .joins(:target_account)
+                              .merge(Account.without_suspended)
                               .where(account: current_account)
                               .paginate_by_max_id(
                                 limit_param(DEFAULT_ACCOUNTS_LIMIT),
index c5ccece134719ca5d6cb7022c7f0a3d459decb81,45151cdd7754d016121379410abdea4df3d25925..b2564a7915afc5556a38b0728dfbd2b7e5ca2d55
@@@ -5,7 -5,7 +5,8 @@@ class Oauth::AuthorizedApplicationsCont
  
    before_action :store_current_location
    before_action :authenticate_resource_owner!
 +  before_action :set_pack
+   before_action :require_not_suspended!, only: :destroy
    before_action :set_body_classes
  
    skip_before_action :require_functional!
      store_location_for(:user, request.url)
    end
  
 +  def set_pack
 +    use_pack 'settings'
 +  end
++
+   def require_not_suspended!
+     forbidden if current_account.suspended?
+   end
  end
index b97603af6f22e6cb5fb0d5d6a71872d8592e015c,8311538a5694419f6c5676ebd323837b5f933531..dee3922d801261e22036299bbd236583efd8d307
@@@ -1,7 -1,9 +1,10 @@@
  # frozen_string_literal: true
  
  class Settings::BaseController < ApplicationController
 +  before_action :set_pack
+   layout 'admin'
+   before_action :authenticate_user!
    before_action :set_body_classes
    before_action :set_cache_headers
  
index b217b3c3becf7aa00118e081107c0ab7cdea32af,bf2899da66fc4424b0d72abbd7617f4d78822371..4618c78836b69a78ab6ab64b3e3e387e4a5d2f97
@@@ -1,11 -1,7 +1,8 @@@
  # frozen_string_literal: true
  
  class Settings::IdentityProofsController < Settings::BaseController
-   layout 'admin'
-   before_action :authenticate_user!
    before_action :check_required_params, only: :new
 +  before_action :check_enabled, only: :new
  
    def index
      @proofs = AccountIdentityProof.where(account: current_account).order(provider: :asc, provider_username: :asc)
Simple merge
Simple merge
Simple merge
index 4467362e1fb9de8d5bbb2c562da4636ff5178b5e,6b21d6ed674217e303ebd662c7c7286e54ea1586..6cd2ca6bdcafac8918344d82b45519fdfce6c5ab
@@@ -177,7 -176,7 +177,7 @@@ class User < ApplicationRecor
    end
  
    def functional?
-     confirmed? && approved? && !disabled? && !account.suspended?
 -    confirmed? && approved? && !disabled? && !account.suspended? && !account.memorial? && account.moved_to_account_id.nil?
++    confirmed? && approved? && !disabled? && !account.suspended? && !account.memorial?
    end
  
    def unconfirmed_or_pending?
index fa5c0dd9ced8a64768e7e174283f80591ba7a719,bcf9c3395ca974291ad738c45fcae14f05702bce..d0359580df2d34fcce0ab5aabbdbfd50f53e17f4
@@@ -12,7 -12,7 +12,8 @@@ class StatusPolicy < ApplicationPolic
    end
  
    def show?
+     return false if author.suspended?
 +    return false if local_only? && (current_account.nil? || !current_account.local?)
  
      if requires_mention?
        owned? || mention_exists?
index 4e497cdbdd28d3f0a4200bb575d75ab94ae954b3,189a62d0eec82b5395687117f5501cde8a085fd6..5cc42c7cfb09f8ec0f14bf51f2f08f86170466db
@@@ -60,7 -59,41 +59,45 @@@ class REST::AccountSerializer < ActiveM
      object.last_status_at&.to_date&.iso8601
    end
  
 +  def followers_count
 +    (Setting.hide_followers_count || object.user&.setting_hide_followers_count) ? -1 : object.followers_count
 +  end
++
+   def display_name
+     object.suspended? ? '' : object.display_name
+   end
+   def locked
+     object.suspended? ? false : object.locked
+   end
+   def bot
+     object.suspended? ? false : object.bot
+   end
+   def discoverable
+     object.suspended? ? false : object.discoverable
+   end
+   def moved_to_account
+     object.suspended? ? nil : object.moved_to_account
+   end
+   def emojis
+     object.suspended? ? [] : object.emojis
+   end
+   def fields
+     object.suspended? ? [] : object.fields
+   end
+   def suspended
+     object.suspended?
+   end
+   delegate :suspended?, to: :object
+   def moved_and_not_nested?
+     object.moved? && object.moved_to_account.moved_to_account_id.nil?
+   end
  end
index f454229704dfb23d2917fb1ea3f216cc7f8a41a7,12f0f1b0852f587cdfb7132b111c50c58538c774..feffb872bec184ae60a2570d016c27c04c894c15
@@@ -58,8 -58,8 +58,8 @@@ class ProcessMentionsService < BaseServ
      mentioned_account = mention.account
  
      if mentioned_account.local?
-       LocalNotificationWorker.perform_async(mentioned_account.id, mention.id, mention.class.name)
+       LocalNotificationWorker.perform_async(mentioned_account.id, mention.id, mention.class.name, :mention)
 -    elsif mentioned_account.activitypub?
 +    elsif mentioned_account.activitypub? && !@status.local_only?
        ActivityPub::DeliveryWorker.perform_async(activitypub_json, mention.status.account_id, mentioned_account.inbox_url)
      end
    end
Simple merge
index fd35af5621238d2a8b180d5012fe35f15f824857,b70c7e3895cedefafdbed574060236c7488d2ccf..45e6bb88dc9e4d81f299b0a56ef14c2838d83b5a
@@@ -45,8 -50,10 +54,12 @@@ class FeedInsertWorke
        FeedManager.instance.push_to_home(@follower, @status)
      when :list
        FeedManager.instance.push_to_list(@list, @status)
 +    when :direct
 +      FeedManager.instance.push_to_direct(@account, @status)
      end
    end
+   def perform_notify
+     NotifyService.new.call(@follower, :status, @status)
+   end
  end
Simple merge
Simple merge
diff --cc db/schema.rb
Simple merge
diff --cc package.json
index 11e2b5c8461ce46f0b2771ee02f92306ef0fe377,d6ed58ca46833974a87acb5bc2be25a76abccbbe..30dfbc47125f96f16725705ab324bf90092a14b2
      "@babel/runtime": "^7.11.2",
      "@clusterws/cws": "^3.0.0",
      "@gamestdio/websocket": "^0.3.2",
-     "@github/webauthn-json": "^0.4.2",
+     "@github/webauthn-json": "^0.5.4",
      "@rails/ujs": "^6.0.3",
      "array-includes": "^3.1.1",
 +    "atrament": "0.2.4",
      "arrow-key-navigation": "^1.2.0",
      "autoprefixer": "^9.8.6",
-     "axios": "^0.19.2",
+     "axios": "^0.20.0",
      "babel-loader": "^8.1.0",
      "babel-plugin-lodash": "^3.3.4",
      "babel-plugin-preval": "^5.0.0",
@@@ -96,8 -94,7 +96,8 @@@
      "escape-html": "^1.0.3",
      "exif-js": "^2.3.0",
      "express": "^4.17.1",
-     "file-loader": "^6.0.0",
 +    "favico.js": "^0.3.10",
+     "file-loader": "^6.1.0",
      "font-awesome": "^4.7.0",
      "glob": "^7.1.6",
      "history": "^4.10.1",
index 36e346f140062842b51eeab5ae144f6c9ea6ceeb,f0380179c1358083bf973c446b25888fff6c6ecf..68eb9c027e6c10938e3a58ed88f930e149380618
@@@ -12,9 -12,9 +12,9 @@@ describe AccountInteractions d
      subject { Account.following_map(target_account_ids, account_id) }
  
      context 'account with Follow' do
 -      it 'returns { target_account_id => true }' do
 +      it 'returns { target_account_id => { reblogs: true } }' do
          Fabricate(:follow, account: account, target_account: target_account)
-         is_expected.to eq(target_account_id => { reblogs: true })
+         is_expected.to eq(target_account_id => { reblogs: true, notify: false })
        end
      end
  
Simple merge
index b09d335ba38095804d7b43cdab5649109871534b,f2cb22c5ef7508d1fd0a535dd379ecf0aec8a550..118436f8ba5c17c18e7e0244738adb646abf0300
@@@ -47,9 -48,10 +48,10 @@@ RSpec.describe NotifyService, type: :se
      recipient.suspend!
      is_expected.to_not change(Notification, :count)
    end
 -
 +  
    context 'for direct messages' do
      let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct)) }
+     let(:type)     { :mention }
  
      before do
        user.settings.interactions = user.settings.interactions.merge('must_be_following_dm' => enabled)
Simple merge
diff --cc yarn.lock
Simple merge