]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'master' into glitch-soc/merge-upstream
authorThibaut Girka <thib@sitedethib.com>
Fri, 13 Sep 2019 16:13:43 +0000 (18:13 +0200)
committerThibaut Girka <thib@sitedethib.com>
Fri, 13 Sep 2019 16:13:43 +0000 (18:13 +0200)
Conflicts:
- Gemfile
- app/controllers/api/v1/search_controller.rb
  Conflict because we changed the number of default results to be
  configurable
- app/lib/settings/scoped_settings.rb
  Addition of a new “noindex” site-wide setting,
  conflict due to our change of the two other site-wide settings
  (default flavour and skin instead of theme)
- spec/controllers/application_controller_spec.rb
  Addition of a new “noindex” site-wide setting,
  conflict due to our change of the two other site-wide settings
  (default flavour and skin instead of theme)

30 files changed:
1  2 
.circleci/config.yml
Gemfile
Gemfile.lock
app/controllers/api/v2/search_controller.rb
app/controllers/application_controller.rb
app/helpers/application_helper.rb
app/javascript/mastodon/locales/defaultMessages.json
app/javascript/mastodon/locales/ja.json
app/javascript/mastodon/locales/pl.json
app/javascript/styles/mastodon/admin.scss
app/lib/formatter.rb
app/lib/settings/scoped_settings.rb
app/models/account.rb
app/models/form/admin_settings.rb
app/models/media_attachment.rb
app/models/status.rb
app/models/user.rb
app/services/remove_status_service.rb
app/views/admin/reports/show.html.haml
app/views/admin/settings/edit.html.haml
config/locales/en.yml
config/locales/ja.yml
config/locales/pl.yml
config/locales/simple_form.ja.yml
config/locales/simple_form.pl.yml
config/routes.rb
db/schema.rb
package.json
spec/controllers/application_controller_spec.rb
yarn.lock

Simple merge
diff --cc Gemfile
index cfaa6e444700c966285f50c36a2cad7d403ec06f,af0e8e2fcfbb091b724b1ce9169f4009ce16f223..b9bdd82403b2c0102fd0902393d0ee6760cdd917
+++ b/Gemfile
@@@ -50,7 -50,7 +50,8 @@@ gem 'fastimage
  gem 'goldfinger', '~> 2.1'
  gem 'hiredis', '~> 0.6'
  gem 'redis-namespace', '~> 1.5'
+ gem 'health_check', '~> 3.0'
 +gem 'html2text'
  gem 'htmlentities', '~> 4.3'
  gem 'http', '~> 3.3'
  gem 'http_accept_language', '~> 2.1'
diff --cc Gemfile.lock
index 68a68c8486546787b4ad55b4d7c328ba27d029f4,6e931c6113ae848eb2e02f6741848ee9e6201b3d..30e5fc1ff88de50c1955d3b6bdc4f20ecfa07aae
@@@ -709,8 -708,8 +711,9 @@@ DEPENDENCIE
    fuubar (~> 2.4)
    goldfinger (~> 2.1)
    hamlit-rails (~> 0.2)
+   health_check (~> 3.0)
    hiredis (~> 0.6)
 +  html2text
    htmlentities (~> 4.3)
    http (~> 3.3)
    http_accept_language (~> 2.1)
index 9aa6edc6969eb2bbda1b7bbcea3ce00aa8062d58,c14cd22d7b90b32cf30aaaeb7d7e1483e5b98a5d..7fdc030e5f69f2cd79e33cb797eff2d2337fe692
@@@ -1,8 -1,32 +1,32 @@@
  # frozen_string_literal: true
  
- class Api::V2::SearchController < Api::V1::SearchController
+ class Api::V2::SearchController < Api::BaseController
+   include Authorization
 -  RESULTS_LIMIT = 20
++  RESULTS_LIMIT = (ENV['MAX_SEARCH_RESULTS'] || 20).to_i
+   before_action -> { doorkeeper_authorize! :read, :'read:search' }
+   before_action :require_user!
+   respond_to :json
    def index
      @search = Search.new(search_results)
-     render json: @search, serializer: REST::V2::SearchSerializer
+     render json: @search, serializer: REST::SearchSerializer
+   end
+   private
+   def search_results
+     SearchService.new.call(
+       params[:q],
+       current_account,
+       limit_param(RESULTS_LIMIT),
+       search_params.merge(resolve: truthy_param?(:resolve))
+     )
+   end
+   def search_params
+     params.permit(:type, :offset, :min_id, :max_id, :account_id)
    end
  end
Simple merge
index d28fe4247c905cd0faf806acec556ff2cdd68a01,1960dafba2f72e45c91b72de678c5c90fc5ff0eb..86c2e90ad5e032f0df3670e60bc2cbeecda29781
    "navigation_bar.personal": "個人用",
    "navigation_bar.pins": "固定したトゥート",
    "navigation_bar.preferences": "ユーザー設定",
-   "navigation_bar.profile_directory": "ディレクトリ",
    "navigation_bar.public_timeline": "連合タイムライン",
 +  "navigation_bar.misc": "その他",
    "navigation_bar.security": "セキュリティ",
    "notification.and_n_others": "and {count, plural, one {# other} other {# others}}",
    "notification.favourite": "{name}さんがあなたのトゥートをお気に入りに登録しました",
Simple merge
index 343996e8a272631367740e82a361fe7a1547363b,9ca39510acd3a3ac567de71cd6b60c021946055f..4d21e0de7125491cc42475e1a513464ffbe69374
@@@ -3,8 -3,8 +3,9 @@@
  module Settings
    class ScopedSettings
      DEFAULTING_TO_UNSCOPED = %w(
 -      theme
 +      flavour
 +      skin
+       noindex
      ).freeze
  
      def initialize(object)
Simple merge
index 57dd3edd9c4dafbd2e31404309ac46568e9c4c07,24196e1828d42ccfc389ae6f51e382c86d21dd85..f1ee38325343c9e325ae937b058bd44474d50bc8
@@@ -49,12 -44,9 +50,13 @@@ class Form::AdminSetting
      show_known_fediverse_at_about_page
      preview_sensitive_media
      profile_directory
 +    hide_followers_count
 +    enable_keybase
 +    show_reblogs_in_public_timelines
 +    show_replies_in_public_timelines
      spam_check_enabled
      trends
+     noindex
    ).freeze
  
    UPLOAD_KEYS = %i(
Simple merge
Simple merge
Simple merge
index b2f7120893a4b5f5cca6f9888200c62baaf27d49,f9352ed3d319f8ed030af066baf2e065bf5eb182..1ddce675cd182a790a7d7ee9b9122fe9db669ac0
@@@ -151,14 -150,8 +152,14 @@@ class RemoveStatusService < BaseServic
      redis.publish('timeline:public:local:media', @payload) if @status.local?
    end
  
 +  def remove_from_direct
 +    @mentions.each do |mention|
 +      FeedManager.instance.unpush_from_direct(mention.account, @status) if mention.account.local?
 +    end
 +  end
 +
    def remove_media
-     return if @options[:redraft]
+     return if @options[:redraft] || (!@options[:immediate] && @status.reported?)
  
      @status.media_attachments.destroy_all
    end
index 5a9b33f04d19bd5425246220ea2a9347c456336a,752386b3ca326fd396abdb920b79fd6253e649d0..e96ea0b0322cf79262eab2eb8cf096dc373426cf
      .fields-group
        = f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html')
  
+     .fields-group
+       = f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html')
 +  .fields-group
 +    = f.input :hide_followers_count, as: :boolean, wrapper: :with_label, label: t('admin.settings.hide_followers_count.title'), hint: t('admin.settings.hide_followers_count.desc_html')
 +
 +  .fields-group
 +    = f.input :enable_keybase, as: :boolean, wrapper: :with_label, label: t('admin.settings.enable_keybase.title'), hint: t('admin.settings.enable_keybase.desc_html')
 +
 +  .fields-group
 +    = f.input :show_reblogs_in_public_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_reblogs_in_public_timelines.title'), hint: t('admin.settings.show_reblogs_in_public_timelines.desc_html')
 +
 +  .fields-group
 +    = f.input :show_replies_in_public_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_replies_in_public_timelines.title'), hint: t('admin.settings.show_replies_in_public_timelines.desc_html')
 +
    .fields-group
      = f.input :spam_check_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.spam_check_enabled.title'), hint: t('admin.settings.spam_check_enabled.desc_html')
  
index 56f0fd2cffcc673e33ec180779413ab68ce0bd43,0a5ca31c1aa7adf72cb779dab550205bf050f6ec..be8c5eec08da2e7d776819c04f6a04b55af0cc9d
@@@ -740,9 -733,9 +746,10 @@@ en
      all: All
      changes_saved_msg: Changes successfully saved!
      copy: Copy
+     no_batch_actions_available: No batch actions available on this page
      order_by: Order by
      save_changes: Save changes
 +    use_this: Use this
      validation_errors:
        one: Something isn't quite right yet! Please review the error below
        other: Something isn't quite right yet! Please review %{count} errors below
Simple merge
Simple merge
Simple merge
Simple merge
index a7e65b034b5c914401ed432e7170fc23d2aae49f,a4dee284244586852229541b576194ee26a7c9db..416bd833ebe233f7604291a056771b4c874a3b2d
@@@ -310,17 -311,10 +317,15 @@@ Rails.application.routes.draw d
          end
        end
  
-       get '/search', to: 'search#index', as: :search
        resources :media,        only: [:create, :update]
        resources :blocks,       only: [:index]
 -      resources :mutes,        only: [:index]
 +      resources :mutes,        only: [:index] do
 +        collection do
 +          get 'details'
 +        end
 +      end
        resources :favourites,   only: [:index]
 +      resources :bookmarks,    only: [:index]
        resources :reports,      only: [:create]
        resources :trends,       only: [:index]
        resources :filters,      only: [:index, :create, :show, :update, :destroy]
diff --cc db/schema.rb
Simple merge
diff --cc package.json
Simple merge
index 67d3c1ce90f7b44b21a61d5e363724d7aa80dcdb,da4a794cddc30d94adcdbc8c200e2cf01173987b..4ac69b719966df5d1844787745cf94391eb1226d
@@@ -111,21 -109,20 +111,22 @@@ describe ApplicationController, type: :
        current_user = Fabricate(:user)
        sign_in current_user
  
 -      allow(Setting).to receive(:[]).with('theme').and_return 'contrast'
 +      allow(Setting).to receive(:[]).with('skin').and_return 'default'
 +      allow(Setting).to receive(:[]).with('flavour').and_return 'vanilla'
+       allow(Setting).to receive(:[]).with('noindex').and_return false
  
 -      expect(controller.view_context.current_theme).to eq 'contrast'
 +      expect(controller.view_context.current_flavour).to eq 'vanilla'
      end
  
 -    it 'returns user\'s theme when it is set' do
 +    it 'returns user\'s flavour when it is set' do
        current_user = Fabricate(:user)
 -      current_user.settings['theme'] = 'mastodon-light'
 +      current_user.settings['flavour'] = 'glitch'
        sign_in current_user
  
 -      allow(Setting).to receive(:[]).with('theme').and_return 'contrast'
 +      allow(Setting).to receive(:[]).with('skin').and_return 'default'
 +      allow(Setting).to receive(:[]).with('flavour').and_return 'vanilla'
  
 -      expect(controller.view_context.current_theme).to eq 'mastodon-light'
 +      expect(controller.view_context.current_flavour).to eq 'glitch'
      end
    end
  
diff --cc yarn.lock
Simple merge