]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'main' into glitch-soc/merge-upstream
authorClaire <claire.github-309c@sitedethib.com>
Wed, 30 Mar 2022 13:02:56 +0000 (15:02 +0200)
committerClaire <claire.github-309c@sitedethib.com>
Wed, 30 Mar 2022 13:02:56 +0000 (15:02 +0200)
1  2 
.github/workflows/build-image.yml
app/models/user.rb
app/validators/status_length_validator.rb
lib/mastodon/version.rb
spec/validators/status_length_validator_spec.rb

index b3a8d5105bf1aad2b94202ac7ee5d5ab1d7239e9,75c7b54a65db278ce53e3198d575fc67aa2deb20..880fdfac940a7ad6a1f79a0926512aac1679b6d6
@@@ -39,8 -35,8 +36,8 @@@ jobs
        - uses: docker/build-push-action@v2
          with:
            context: .
-           platforms: ${{ matrix.os }}
+           platforms: linux/amd64,linux/arm64
            push: ${{ github.event_name != 'pull_request' }}
            tags: ${{ steps.meta.outputs.tags }}
 -          cache-from: type=registry,ref=tootsuite/mastodon:latest
 +          cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/mastodon:latest
            cache-to: type=inline
Simple merge
index 2a3ac8862a679d916a8bd8d85066fd3a663034c8,e107912b77df6352a5234e5f3e1213c9d96d3e4a..f93450ba6550209659e7d8020a19ac168597cbcc
@@@ -1,9 -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_CHARS = 23
-   URL_PLACEHOLDER = "\1#{'x' * URL_PLACEHOLDER_CHARS}"
+   URL_PLACEHOLDER = 'x' * 23
  
    def validate(status)
      return unless status.local? && !status.reblog?
Simple merge
index 643ea6d229c48dd34894084a7461cfcb8fa30508,db9c728a8b698f556150d5debf23af0ce656c873..4c80a59e64981d62d1deb7ccfc89ce165f6c1c64
@@@ -55,10 -50,15 +55,17 @@@ describe StatusLengthValidator d
        expect(status.errors).to have_received(:add)
      end
  
+     it 'does not count overly long URLs as 23 characters flat' do
+       text = "http://example.com/valid?#{'#foo?' * 1000}"
+       status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
+       subject.validate(status)
+       expect(status.errors).to have_received(:add)
+     end
      it 'counts only the front part of remote usernames' do
 -      text   = ('a' * 475) + " @alice@#{'b' * 30}.com"
 +      username = '@alice'
 +      chars = StatusLengthValidator::MAX_CHARS - 1 - username.length
 +      text   = ('a' * 475) + " #{username}@#{'b' * 30}.com"
        status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
  
        subject.validate(status)