From: Claire Date: Sun, 11 Jul 2021 19:41:23 +0000 (+0200) Subject: Merge branch 'main' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=cdf20f4367226bc5682a0b040fa62f56d6f58fb5;p=mastodon.git Merge branch 'main' into glitch-soc/merge-upstream Conflicts: - `app/serializers/rest/instance_serializer.rb`: Upstream changed the fields returned by /api/v1/instance by adding a `configuration` field holding a lot of useful information making our `max_toot_chars` and `poll_limits` fields obsolete. Keeping those around for now for compatibility. - `app/validators/status_length_validator.rb`: No real conflict, just URL_PLACEHOLDER_CHARS introduced too close to MAX_CHARS which is defined differently in glitch-soc. Ported upstream changes. --- cdf20f4367226bc5682a0b040fa62f56d6f58fb5 diff --cc Gemfile.lock index 04f8be599,3db3ea786..f17bcd87a --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -763,10 -761,8 +762,9 @@@ DEPENDENCIE rails-i18n (~> 6.0) rails-settings-cached (~> 0.6) rdf-normalize (~> 0.4) + redcarpet (~> 3.5) redis (~> 4.3) redis-namespace (~> 1.8) - resolv (~> 0.1.0) rqrcode (~> 2.0) rspec-rails (~> 5.0) rspec-sidekiq (~> 3.1) diff --cc app/serializers/rest/instance_serializer.rb index ae8b80fb7,0dc44b623..48bbb55c8 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@@ -4,8 -4,9 +4,9 @@@ class REST::InstanceSerializer < Active include RoutingHelper attributes :uri, :title, :short_description, :description, :email, - :version, :urls, :stats, :thumbnail, + :version, :urls, :stats, :thumbnail, :max_toot_chars, :poll_limits, - :languages, :registrations, :approval_required, :invites_enabled + :languages, :registrations, :approval_required, :invites_enabled, + :configuration has_one :contact_account, serializer: REST::AccountSerializer diff --cc app/validators/status_length_validator.rb index 11997024f,4c258ec16..2a3ac8862 --- a/app/validators/status_length_validator.rb +++ b/app/validators/status_length_validator.rb @@@ -1,8 -1,9 +1,9 @@@ # frozen_string_literal: true class StatusLengthValidator < ActiveModel::Validator - MAX_CHARS = 500 + MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i - URL_PLACEHOLDER = "\1#{'x' * 23}" + URL_PLACEHOLDER_CHARS = 23 + URL_PLACEHOLDER = "\1#{'x' * URL_PLACEHOLDER_CHARS}" def validate(status) return unless status.local? && !status.reblog?