Merge branch 'main' into glitch-soc/merge-upstream

- `app/views/statuses/_simple_status.html.haml`:
  Small markup change in glitch-soc, on a line that has been modified by
  upstream. Ported upstream changes.
master
Claire 3 years ago
commit 50b430d9a2
  1. 27
      .circleci/config.yml
  2. 2
      .ruby-version
  3. 2
      Dockerfile
  4. 14
      Gemfile
  5. 41
      Gemfile.lock
  6. 6
      app/controllers/accounts_controller.rb
  7. 2
      app/controllers/activitypub/outboxes_controller.rb
  8. 44
      app/controllers/admin/instances_controller.rb
  9. 3
      app/controllers/admin/statuses_controller.rb
  10. 4
      app/controllers/api/v1/accounts_controller.rb
  11. 2
      app/controllers/api/v1/follow_requests_controller.rb
  12. 10
      app/controllers/api/v1/suggestions_controller.rb
  13. 15
      app/controllers/application_controller.rb
  14. 4
      app/controllers/auth/confirmations_controller.rb
  15. 10
      app/controllers/directories_controller.rb
  16. 5
      app/controllers/statuses_controller.rb
  17. 4
      app/helpers/admin/action_logs_helper.rb
  18. 2
      app/helpers/application_helper.rb
  19. 2
      app/helpers/jsonld_helper.rb
  20. 3
      app/helpers/settings_helper.rb
  21. 80
      app/helpers/statuses_helper.rb
  22. 7
      app/javascript/mastodon/actions/importer/normalizer.js
  23. 1
      app/javascript/mastodon/actions/search.js
  24. 16
      app/javascript/mastodon/actions/timelines.js
  25. 4
      app/javascript/mastodon/components/regeneration_indicator.js
  26. 4
      app/javascript/mastodon/components/status_content.js
  27. 2
      app/javascript/mastodon/features/account/components/header.js
  28. 8
      app/javascript/mastodon/features/compose/components/search_results.js
  29. 20
      app/javascript/mastodon/features/follow_recommendations/index.js
  30. 4
      app/javascript/mastodon/features/home_timeline/index.js
  31. 2
      app/javascript/mastodon/features/notifications/index.js
  32. 3
      app/javascript/mastodon/features/ui/index.js
  33. 473
      app/javascript/mastodon/locales/af.json
  34. 253
      app/javascript/mastodon/locales/ar.json
  35. 21
      app/javascript/mastodon/locales/ast.json
  36. 749
      app/javascript/mastodon/locales/bg.json
  37. 21
      app/javascript/mastodon/locales/bn.json
  38. 21
      app/javascript/mastodon/locales/br.json
  39. 21
      app/javascript/mastodon/locales/ca.json
  40. 25
      app/javascript/mastodon/locales/co.json
  41. 81
      app/javascript/mastodon/locales/cs.json
  42. 21
      app/javascript/mastodon/locales/cy.json
  43. 459
      app/javascript/mastodon/locales/da.json
  44. 23
      app/javascript/mastodon/locales/de.json
  45. 121
      app/javascript/mastodon/locales/defaultMessages.json
  46. 35
      app/javascript/mastodon/locales/el.json
  47. 153
      app/javascript/mastodon/locales/en.json
  48. 61
      app/javascript/mastodon/locales/eo.json
  49. 67
      app/javascript/mastodon/locales/es-AR.json
  50. 23
      app/javascript/mastodon/locales/es.json
  51. 21
      app/javascript/mastodon/locales/et.json
  52. 101
      app/javascript/mastodon/locales/eu.json
  53. 29
      app/javascript/mastodon/locales/fa.json
  54. 21
      app/javascript/mastodon/locales/fi.json
  55. 25
      app/javascript/mastodon/locales/fr.json
  56. 21
      app/javascript/mastodon/locales/ga.json
  57. 473
      app/javascript/mastodon/locales/gd.json
  58. 25
      app/javascript/mastodon/locales/gl.json
  59. 21
      app/javascript/mastodon/locales/he.json
  60. 21
      app/javascript/mastodon/locales/hi.json
  61. 37
      app/javascript/mastodon/locales/hr.json
  62. 23
      app/javascript/mastodon/locales/hu.json
  63. 21
      app/javascript/mastodon/locales/hy.json
  64. 23
      app/javascript/mastodon/locales/id.json
  65. 21
      app/javascript/mastodon/locales/io.json
  66. 21
      app/javascript/mastodon/locales/is.json
  67. 65
      app/javascript/mastodon/locales/it.json
  68. 31
      app/javascript/mastodon/locales/ja.json
  69. 21
      app/javascript/mastodon/locales/ka.json
  70. 29
      app/javascript/mastodon/locales/kab.json
  71. 21
      app/javascript/mastodon/locales/kk.json
  72. 21
      app/javascript/mastodon/locales/kn.json
  73. 21
      app/javascript/mastodon/locales/ko.json
  74. 21
      app/javascript/mastodon/locales/ku.json
  75. 473
      app/javascript/mastodon/locales/kw.json
  76. 21
      app/javascript/mastodon/locales/lt.json
  77. 39
      app/javascript/mastodon/locales/lv.json
  78. 21
      app/javascript/mastodon/locales/mk.json
  79. 81
      app/javascript/mastodon/locales/ml.json
  80. 21
      app/javascript/mastodon/locales/mr.json
  81. 21
      app/javascript/mastodon/locales/ms.json
  82. 61
      app/javascript/mastodon/locales/nl.json
  83. 29
      app/javascript/mastodon/locales/nn.json
  84. 21
      app/javascript/mastodon/locales/no.json
  85. 23
      app/javascript/mastodon/locales/oc.json
  86. 473
      app/javascript/mastodon/locales/pa.json
  87. 23
      app/javascript/mastodon/locales/pl.json
  88. 25
      app/javascript/mastodon/locales/pt-BR.json
  89. 57
      app/javascript/mastodon/locales/pt-PT.json
  90. 21
      app/javascript/mastodon/locales/ro.json
  91. 21
      app/javascript/mastodon/locales/ru.json
  92. 21
      app/javascript/mastodon/locales/sa.json
  93. 81
      app/javascript/mastodon/locales/sc.json
  94. 473
      app/javascript/mastodon/locales/si.json
  95. 21
      app/javascript/mastodon/locales/sk.json
  96. 21
      app/javascript/mastodon/locales/sl.json
  97. 35
      app/javascript/mastodon/locales/sq.json
  98. 21
      app/javascript/mastodon/locales/sr-Latn.json
  99. 193
      app/javascript/mastodon/locales/sr.json
  100. 53
      app/javascript/mastodon/locales/sv.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -129,6 +129,13 @@ jobs:
environment: *ruby_environment
<<: *install_ruby_dependencies
install-ruby3.0:
<<: *defaults
docker:
- image: circleci/ruby:3.0-buster-node
environment: *ruby_environment
<<: *install_ruby_dependencies
build:
<<: *defaults
steps:
@ -187,6 +194,18 @@ jobs:
- image: circleci/redis:5-alpine
<<: *test_steps
test-ruby3.0:
<<: *defaults
docker:
- image: circleci/ruby:3.0-buster-node
environment: *ruby_environment
- image: circleci/postgres:12.2
environment:
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
<<: *test_steps
test-webui:
<<: *defaults
docker:
@ -227,6 +246,10 @@ workflows:
requires:
- install
- install-ruby2.7
- install-ruby3.0:
requires:
- install
- install-ruby2.7
- build:
requires:
- install-ruby2.7
@ -241,6 +264,10 @@ workflows:
requires:
- install-ruby2.6
- build
- test-ruby3.0:
requires:
- install-ruby3.0
- build
- test-webui:
requires:
- install

@ -1 +1 @@
2.7.3
2.7.2

@ -26,7 +26,7 @@ RUN ARCH= && \
mv node-v$NODE_VER-linux-$ARCH /opt/node
# Install Ruby
ENV RUBY_VER="2.7.3"
ENV RUBY_VER="2.7.2"
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential \
bison libyaml-dev libgdbm-dev libreadline-dev libjemalloc-dev \

@ -1,7 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '>= 2.5.0', '< 3.0.0'
ruby '>= 2.5.0', '< 3.1.0'
gem 'pkg-config', '~> 1.4'
@ -17,12 +17,10 @@ gem 'makara', '~> 0.5'
gem 'pghero', '~> 2.8'
gem 'dotenv-rails', '~> 2.7'
gem 'aws-sdk-s3', '~> 1.93', require: false
gem 'aws-sdk-s3', '~> 1.94', require: false
gem 'fog-core', '<= 2.1.0'
gem 'fog-openstack', '~> 0.3', require: false
gem 'paperclip', '~> 6.0'
gem 'paperclip-av-transcoder', '~> 0.6'
gem 'streamio-ffmpeg', '~> 3.0'
gem 'blurhash', '~> 0.1'
gem 'active_model_serializers', '~> 0.10'
@ -33,7 +31,7 @@ gem 'charlock_holmes', '~> 0.7.7'
gem 'iso-639'
gem 'chewy', '~> 5.2'
gem 'cld3', '~> 3.4.2'
gem 'devise', '~> 4.7'
gem 'devise', '~> 4.8'
gem 'devise-two-factor', '~> 4.0'
group :pam_authentication, optional: true do
@ -93,7 +91,7 @@ gem 'strong_migrations', '~> 0.7'
gem 'tty-prompt', '~> 0.23', require: false
gem 'twitter-text', '~> 3.1.0'
gem 'tzinfo-data', '~> 1.2021'
gem 'webpacker', '~> 5.2'
gem 'webpacker', '~> 5.3'
gem 'webpush', '~> 0.3'
gem 'webauthn', '~> 3.0.0.alpha1'
@ -138,7 +136,7 @@ group :development do
gem 'letter_opener', '~> 1.7'
gem 'letter_opener_web', '~> 1.4'
gem 'memory_profiler'
gem 'rubocop', '~> 1.12', require: false
gem 'rubocop', '~> 1.13', require: false
gem 'rubocop-rails', '~> 2.9', require: false
gem 'brakeman', '~> 5.0', require: false
gem 'bundler-audit', '~> 0.8', require: false
@ -159,3 +157,5 @@ gem 'concurrent-ruby', require: false
gem 'connection_pool', require: false
gem 'xorcist', '~> 1.1'
gem 'resolv', '~> 0.1.0'

@ -77,11 +77,9 @@ GEM
ast (2.4.2)
attr_encrypted (3.1.0)
encryptor (~> 3.0.0)
av (0.9.0)
cocaine (~> 0.5.3)
awrence (1.1.1)
aws-eventstream (1.1.1)
aws-partitions (1.445.0)
aws-partitions (1.449.0)
aws-sdk-core (3.114.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
@ -90,7 +88,7 @@ GEM
aws-sdk-kms (1.43.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.93.1)
aws-sdk-s3 (1.94.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
@ -156,8 +154,6 @@ GEM
cld3 (3.4.2)
ffi (>= 1.1.0, < 1.16.0)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.3)
color_diff (0.1)
concurrent-ruby (1.1.8)
@ -171,7 +167,7 @@ GEM
css_parser (1.7.1)
addressable
debug_inspector (1.0.0)
devise (4.7.3)
devise (4.8.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
@ -296,7 +292,7 @@ GEM
ipaddress (0.8.3)
iso-639 (0.3.5)
jmespath (1.4.0)
json (2.3.1)
json (2.5.1)
json-canonicalization (0.2.1)
json-ld (3.1.9)
htmlentities (~> 4.3)
@ -348,7 +344,7 @@ GEM
redis (>= 3.0.5)
memory_profiler (1.0.0)
method_source (1.0.0)
microformats (4.2.1)
microformats (4.3.1)
json (~> 2.2)
nokogiri (~> 1.10)
mime-types (3.3.1)
@ -358,7 +354,7 @@ GEM
nokogiri (~> 1)
rake
mini_mime (1.0.3)
mini_portile2 (2.5.0)
mini_portile2 (2.5.1)
minitest (5.14.4)
msgpack (1.4.2)
multi_json (1.15.0)
@ -402,9 +398,6 @@ GEM
mime-types
mimemagic (~> 0.3.0)
terrapin (~> 0.6.0)
paperclip-av-transcoder (0.6.4)
av (~> 0.9.0)
paperclip (>= 2.5.2)
parallel (1.20.1)
parallel_tests (3.7.0)
parallel
@ -499,6 +492,7 @@ GEM
regexp_parser (2.1.1)
request_store (1.5.0)
rack (>= 1.4)
resolv (0.1.0)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
@ -531,7 +525,7 @@ GEM
rspec-support (3.10.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.12.1)
rubocop (1.13.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
@ -562,7 +556,7 @@ GEM
activerecord (>= 4.0.0)
railties (>= 4.0.0)
securecompare (1.0.0)
semantic_range (2.3.0)
semantic_range (3.0.0)
sidekiq (6.2.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
@ -576,7 +570,7 @@ GEM
sidekiq (>= 3)
thwait
tilt (>= 1.4.0)
sidekiq-unique-jobs (7.0.8)
sidekiq-unique-jobs (7.0.9)
brpoplpush-redis_script (> 0.1.1, <= 2.0.0)
concurrent-ruby (~> 1.0, >= 1.0.5)
sidekiq (>= 5.0, < 7.0)
@ -605,8 +599,6 @@ GEM
stackprof (0.2.16)
statsd-ruby (1.5.0)
stoplight (2.2.1)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
strong_migrations (0.7.6)
activerecord (>= 5)
temple (0.8.2)
@ -659,7 +651,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.2.1)
webpacker (5.3.0)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
@ -684,7 +676,7 @@ DEPENDENCIES
active_record_query_trace (~> 1.8)
addressable (~> 2.7)
annotate (~> 3.1)
aws-sdk-s3 (~> 1.93)
aws-sdk-s3 (~> 1.94)
better_errors (~> 2.9)
binding_of_caller (~> 1.0)
blurhash (~> 0.1)
@ -705,7 +697,7 @@ DEPENDENCIES
color_diff (~> 0.1)
concurrent-ruby
connection_pool
devise (~> 4.7)
devise (~> 4.8)
devise-two-factor (~> 4.0)
devise_pam_authenticatable2 (~> 9.2)
discard (~> 1.2)
@ -750,7 +742,6 @@ DEPENDENCIES
omniauth-saml (~> 1.10)
ox (~> 2.14)
paperclip (~> 6.0)
paperclip-av-transcoder (~> 0.6)
parallel (~> 1.20)
parallel_tests (~> 3.7)
parslet
@ -775,11 +766,12 @@ DEPENDENCIES
redcarpet (~> 3.5)
redis (~> 4.2)
redis-namespace (~> 1.8)
resolv (~> 0.1.0)
rqrcode (~> 1.2)
rspec-rails (~> 5.0)
rspec-sidekiq (~> 3.1)
rspec_junit_formatter (~> 0.4)
rubocop (~> 1.12)
rubocop (~> 1.13)
rubocop-rails (~> 2.9)
ruby-progressbar (~> 1.11)
sanitize (~> 5.2)
@ -795,7 +787,6 @@ DEPENDENCIES
sprockets-rails (~> 3.2)
stackprof
stoplight (~> 2.2.1)
streamio-ffmpeg (~> 3.0)
strong_migrations (~> 0.7)
thor (~> 1.1)
tty-prompt (~> 0.23)
@ -803,6 +794,6 @@ DEPENDENCIES
tzinfo-data (~> 1.2021)
webauthn (~> 3.0.0.alpha1)
webmock (~> 3.12)
webpacker (~> 5.2)
webpacker (~> 5.3)
webpush (~> 0.3)
xorcist (~> 1.1)

@ -78,11 +78,7 @@ class AccountsController < ApplicationController
end
def only_media_scope
Status.where(id: account_media_status_ids)
end
def account_media_status_ids
@account.media_attachments.attached.reorder(nil).select(:status_id).group(:status_id)
Status.joins(:media_attachments).merge(@account.media_attachments.reorder(nil)).group(:id)
end
def no_replies_scope

@ -20,7 +20,7 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController
def outbox_presenter
if page_requested?
ActivityPub::CollectionPresenter.new(
id: outbox_url(page_params),
id: outbox_url(**page_params),
type: :ordered,
part_of: outbox_url,
prev: prev_page,

@ -3,7 +3,8 @@
module Admin
class InstancesController < BaseController
before_action :set_instances, only: :index
before_action :set_instance, only: :show
before_action :set_instance, except: :index
before_action :set_exhausted_deliveries_days, only: :show
def index
authorize :instance, :index?
@ -13,14 +14,55 @@ module Admin
authorize :instance, :show?
end
def clear_delivery_errors
authorize :delivery, :clear_delivery_errors?
@instance.delivery_failure_tracker.clear_failures!
redirect_to admin_instance_path(@instance.domain)
end
def restart_delivery
authorize :delivery, :restart_delivery?
last_unavailable_domain = unavailable_domain
if last_unavailable_domain.present?
@instance.delivery_failure_tracker.track_success!
log_action :destroy, last_unavailable_domain
end
redirect_to admin_instance_path(@instance.domain)
end
def stop_delivery
authorize :delivery, :stop_delivery?
UnavailableDomain.create(domain: @instance.domain)
log_action :create, unavailable_domain
redirect_to admin_instance_path(@instance.domain)
end
private
def set_instance
@instance = Instance.find(params[:id])
end
def set_exhausted_deliveries_days
@exhausted_deliveries_days = @instance.delivery_failure_tracker.exhausted_deliveries_days
end
def set_instances
@instances = filtered_instances.page(params[:page])
warning_domains_map = DeliveryFailureTracker.warning_domains_map
@instances.each do |instance|
instance.failure_days = warning_domains_map[instance.domain]
end
end
def unavailable_domain
UnavailableDomain.find_by(domain: @instance.domain)
end
def filtered_instances

@ -14,8 +14,7 @@ module Admin
@statuses = @account.statuses.where(visibility: [:public, :unlisted])
if params[:media]
account_media_status_ids = @account.media_attachments.attached.reorder(nil).select(:status_id).group(:status_id)
@statuses.merge!(Status.where(id: account_media_status_ids))
@statuses.merge!(Status.joins(:media_attachments).merge(@account.media_attachments.reorder(nil)).group(:id))
end
@statuses = @statuses.preload(:media_attachments, :mentions).page(params[:page]).per(PER_PAGE)

@ -35,7 +35,7 @@ class Api::V1::AccountsController < Api::BaseController
follow = FollowService.new.call(current_user.account, @account, reblogs: params.key?(:reblogs) ? truthy_param?(:reblogs) : nil, notify: params.key?(:notify) ? truthy_param?(:notify) : nil, with_rate_limit: true)
options = @account.locked? || current_user.account.silenced? ? {} : { following_map: { @account.id => { reblogs: follow.show_reblogs?, notify: follow.notify? } }, requested_map: { @account.id => false } }
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(options)
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(**options)
end
def block
@ -70,7 +70,7 @@ class Api::V1::AccountsController < Api::BaseController
end
def relationships(**options)
AccountRelationshipsPresenter.new([@account.id], current_user.account_id, options)
AccountRelationshipsPresenter.new([@account.id], current_user.account_id, **options)
end
def account_params

@ -29,7 +29,7 @@ class Api::V1::FollowRequestsController < Api::BaseController
end
def relationships(**options)
AccountRelationshipsPresenter.new([params[:id]], current_user.account_id, options)
AccountRelationshipsPresenter.new([params[:id]], current_user.account_id, **options)
end
def load_accounts

@ -5,20 +5,20 @@ class Api::V1::SuggestionsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :require_user!
before_action :set_accounts
def index
render json: @accounts, each_serializer: REST::AccountSerializer
suggestions = suggestions_source.get(current_account, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
render json: suggestions.map(&:account), each_serializer: REST::AccountSerializer
end
def destroy
PotentialFriendshipTracker.remove(current_account.id, params[:id])
suggestions_source.remove(current_account, params[:id])
render_empty
end
private
def set_accounts
@accounts = PotentialFriendshipTracker.get(current_account, limit_param(DEFAULT_ACCOUNTS_LIMIT))
def suggestions_source
AccountSuggestions::PastInteractionsSource.new
end
end

@ -19,17 +19,16 @@ class ApplicationController < ActionController::Base
helper_method :use_seamless_external_login?
helper_method :whitelist_mode?
rescue_from ActionController::RoutingError, with: :not_found
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
rescue_from ActionController::UnknownFormat, with: :not_acceptable
rescue_from ActionController::ParameterMissing, with: :bad_request
rescue_from Paperclip::AdapterRegistry::NoHandlerError, with: :bad_request
rescue_from ActiveRecord::RecordNotFound, with: :not_found
rescue_from ActionController::ParameterMissing, Paperclip::AdapterRegistry::NoHandlerError, with: :bad_request
rescue_from Mastodon::NotPermittedError, with: :forbidden
rescue_from HTTP::Error, OpenSSL::SSL::SSLError, with: :internal_server_error
rescue_from Mastodon::RaceConditionError, Seahorse::Client::NetworkingError, Stoplight::Error::RedLight, with: :service_unavailable
rescue_from ActionController::RoutingError, ActiveRecord::RecordNotFound, with: :not_found
rescue_from ActionController::UnknownFormat, with: :not_acceptable
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
rescue_from Mastodon::RateLimitExceededError, with: :too_many_requests
rescue_from HTTP::Error, OpenSSL::SSL::SSLError, with: :internal_server_error
rescue_from Mastodon::RaceConditionError, Seahorse::Client::NetworkingError, Stoplight::Error::RedLight, ActiveRecord::SerializationFailure, with: :service_unavailable
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
before_action :require_functional!, if: :user_signed_in?

@ -22,7 +22,9 @@ class Auth::ConfirmationsController < Devise::ConfirmationsController
end
def require_unconfirmed!
redirect_to edit_user_registration_path if user_signed_in? && current_user.confirmed? && current_user.unconfirmed_email.blank?
if user_signed_in? && current_user.confirmed? && current_user.unconfirmed_email.blank?
redirect_to(current_user.approved? ? root_path : edit_user_registration_path)
end
end
def set_body_classes

@ -6,7 +6,6 @@ class DirectoriesController < ApplicationController
before_action :authenticate_user!, if: :whitelist_mode?
before_action :require_enabled!
before_action :set_instance_presenter
before_action :set_tag, only: :show
before_action :set_accounts
before_action :set_pack
@ -16,10 +15,6 @@ class DirectoriesController < ApplicationController
render :index
end
def show
render :index
end
private
def set_pack
@ -30,13 +25,8 @@ class DirectoriesController < ApplicationController
return not_found unless Setting.profile_directory
end
def set_tag
@tag = Tag.discoverable.find_normalized!(params[:id])
end
def set_accounts
@accounts = Account.local.discoverable.by_recent_status.page(params[:page]).per(20).tap do |query|
query.merge!(Account.tagged_with(@tag.id)) if @tag
query.merge!(Account.not_excluded_by_account(current_account)) if current_account
end
end

@ -16,7 +16,6 @@ class StatusesController < ApplicationController
before_action :set_referrer_policy_header, only: :show
before_action :set_cache_headers
before_action :set_body_classes
before_action :set_autoplay, only: :embed
skip_around_action :set_locale, if: -> { request.format == :json }
skip_before_action :require_functional!, only: [:show, :embed], unless: :whitelist_mode?
@ -85,8 +84,4 @@ class StatusesController < ApplicationController
def set_referrer_policy_header
response.headers['Referrer-Policy'] = 'origin' unless @status.distributable?
end
def set_autoplay
@autoplay = truthy_param?(:autoplay)
end
end

@ -21,7 +21,7 @@ module Admin::ActionLogsHelper
record.shortcode
when 'Report'
link_to "##{record.id}", admin_report_path(record)
when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock'
when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock', 'UnavailableDomain'
link_to record.domain, "https://#{record.domain}"
when 'Status'
link_to record.account.acct, ActivityPub::TagManager.instance.url_for(record)
@ -38,7 +38,7 @@ module Admin::ActionLogsHelper
case type
when 'CustomEmoji'
attributes['shortcode']
when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock'
when 'DomainBlock', 'DomainAllow', 'EmailDomainBlock', 'UnavailableDomain'
link_to attributes['domain'], "https://#{attributes['domain']}"
when 'Status'
tmp_status = Status.new(attributes.except('reblogs_count', 'favourites_count'))

@ -91,6 +91,8 @@ module ApplicationHelper
fa_icon('unlock', title: I18n.t('statuses.visibilities.unlisted'))
elsif status.private_visibility? || status.limited_visibility?
fa_icon('lock', title: I18n.t('statuses.visibilities.private'))
elsif status.direct_visibility?
fa_icon('envelope', title: I18n.t('statuses.visibilities.direct'))
end
end

@ -67,7 +67,7 @@ module JsonLdHelper
unless id
json = fetch_resource_without_id_validation(uri, on_behalf_of)
return unless json
return if !json.is_a?(Hash) || unsupported_uri_scheme?(json['id'])
uri = json['id']
end

@ -2,6 +2,7 @@
module SettingsHelper
HUMAN_LOCALES = {
af: 'Afrikaans',
ar: 'العربية',
ast: 'Asturianu',
bg: 'Български',
@ -24,6 +25,7 @@ module SettingsHelper
fi: 'Suomi',
fr: 'Français',
ga: 'Gaeilge',
gd: 'Gàidhlig',
gl: 'Galego',
he: 'עברית',
hi: 'हि',
@ -59,6 +61,7 @@ module SettingsHelper
ru: 'Русский',
sa: 'सतम',
sc: 'Sardu',
si: 'සහල',
sk: 'Slovenčina',
sl: 'Slovenščina',
sq: 'Shqip',

@ -130,4 +130,84 @@ module StatusesHelper
def embedded_view?
params[:controller] == EMBEDDED_CONTROLLER && params[:action] == EMBEDDED_ACTION
end
def render_video_component(status, **options)
video = status.media_attachments.first
meta = video.file.meta || {}
component_params = {
sensitive: sensitized?(status, current_account),
src: full_asset_url(video.file.url(:original)),
preview: full_asset_url(video.thumbnail.present? ? video.thumbnail.url : video.file.url(:small)),
alt: video.description,
blurhash: video.blurhash,
frameRate: meta.dig('original', 'frame_rate'),
inline: true,
media: [
ActiveModelSerializers::SerializableResource.new(video, serializer: REST::MediaAttachmentSerializer),
].as_json,
}.merge(**options)
react_component :video, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.media_attachments }
end
end
def render_audio_component(status, **options)
audio = status.media_attachments.first
meta = audio.file.meta || {}
component_params = {
src: full_asset_url(audio.file.url(:original)),
poster: full_asset_url(audio.thumbnail.present? ? audio.thumbnail.url : status.account.avatar_static_url),
alt: audio.description,
backgroundColor: meta.dig('colors', 'background'),
foregroundColor: meta.dig('colors', 'foreground'),
accentColor: meta.dig('colors', 'accent'),
duration: meta.dig('original', 'duration'),
}.merge(**options)
react_component :audio, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.media_attachments }
end
end
def render_media_gallery_component(status, **options)
component_params = {
sensitive: sensitized?(status, current_account),
autoplay: prefers_autoplay?,
media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json },
}.merge(**options)
react_component :media_gallery, component_params do
render partial: 'statuses/attachment_list', locals: { attachments: status.media_attachments }
end
end
def render_card_component(status, **options)
component_params = {
sensitive: sensitized?(status, current_account),
maxDescription: 160,
card: ActiveModelSerializers::SerializableResource.new(status.preview_card, serializer: REST::PreviewCardSerializer).as_json,
}.merge(**options)
react_component :card, component_params
end
def render_poll_component(status, **options)
component_params = {
disabled: true,
poll: ActiveModelSerializers::SerializableResource.new(status.preloadable_poll, serializer: REST::PollSerializer, scope: current_user, scope_name: :current_user).as_json,
}.merge(**options)
react_component :poll, component_params do
render partial: 'statuses/poll', locals: { status: status, poll: status.preloadable_poll, autoplay: prefers_autoplay? }
end
end
def prefers_autoplay?
ActiveModel::Type::Boolean.new.cast(params[:autoplay]) || current_user&.setting_auto_play_gif
end
end