]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'main' into glitch-soc/merge-upstream
authorClaire <claire.github-309c@sitedethib.com>
Tue, 2 Mar 2021 11:06:58 +0000 (12:06 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Tue, 2 Mar 2021 11:06:58 +0000 (12:06 +0100)
Conflicts:
- `app/validators/status_length_validator.rb`:
  Upstream changes too close to glitch-soc MAX_CHARS changes, but not a real
  conflict.
  Applied upstream changes.
- `package.json`:
  glitch-soc-only dependency textually too close to a dependency updated
  upstream, not a real conflict.
  Applied upstream changes.

1  2 
Gemfile
Gemfile.lock
app/lib/formatter.rb
app/validators/status_length_validator.rb
app/views/about/more.html.haml
config/routes.rb
package.json
spec/lib/formatter_spec.rb
spec/validators/status_length_validator_spec.rb
yarn.lock

diff --cc Gemfile
Simple merge
diff --cc Gemfile.lock
Simple merge
Simple merge
index 92ee5e64324e283395f6ec1a6fbbf770648d7abe,b56c5a3212e18ce9ec98a5be3fa90e0e47513b67..dcbc4a41a75b2a0b90b74da2ef5a636e21c28f03
@@@ -1,7 -1,14 +1,14 @@@
  # frozen_string_literal: true
  
  class StatusLengthValidator < ActiveModel::Validator
 -  MAX_CHARS = 500
 +  MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i
+   URL_PATTERN = %r{
+     (?:
+       (#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]})
+       (#{FetchLinkCardService::URL_PATTERN})
+     )
+   }iox
+   URL_PLACEHOLDER = "\1#{'x' * 23}"
  
    def validate(status)
      return unless status.local? && !status.reblog?
Simple merge
Simple merge
diff --cc package.json
index e81844964be2896bf73041b305b2d5c15ef24471,bff9db5667dd391c7d6b162a36d7efb60867204e..1cb3b86501e1a214d9377181f64b864db068045d
@@@ -72,8 -71,7 +72,8 @@@
      "@gamestdio/websocket": "^0.3.2",
      "@github/webauthn-json": "^0.5.7",
      "@rails/ujs": "^6.1.3",
-     "array-includes": "^3.1.2",
+     "array-includes": "^3.1.3",
 +    "atrament": "0.2.4",
      "arrow-key-navigation": "^1.2.0",
      "autoprefixer": "^9.8.6",
      "axios": "^0.21.1",
Simple merge
index 62791cd2f0a0ff0f36aac2d0840e1780e8010701,bef3f29f50c915b8c92a10c2a0ddef20d0c271a5..643ea6d229c48dd34894084a7461cfcb8fa30508
@@@ -47,10 -42,16 +47,18 @@@ describe StatusLengthValidator d
        expect(status.errors).to_not have_received(:add)
      end
  
+     it 'does not count non-autolinkable URLs as 23 characters flat' do
+       text   = ('a' * 476) + "http://#{'b' * 30}.com/example"
+       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)
diff --cc yarn.lock
Simple merge