Merge pull request #1176 from ThibG/glitch-soc/merge-upstream

Merge upstream changes
This commit is contained in:
ThibG 2019-07-24 16:53:25 +02:00 committed by GitHub
commit c011361902
11 changed files with 146 additions and 119 deletions

View file

@ -45,9 +45,9 @@ GEM
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.10.9) active_model_serializers (0.10.10)
actionpack (>= 4.1, < 6) actionpack (>= 4.1, < 6.1)
activemodel (>= 4.1, < 6) activemodel (>= 4.1, < 6.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
active_record_query_trace (1.6.2) active_record_query_trace (1.6.2)
@ -306,7 +306,7 @@ GEM
json-ld (~> 3.0) json-ld (~> 3.0)
multi_json (~> 1.12) multi_json (~> 1.12)
rdf (~> 3.0) rdf (~> 3.0)
jsonapi-renderer (0.2.0) jsonapi-renderer (0.2.2)
jwt (2.1.0) jwt (2.1.0)
kaminari (1.1.1) kaminari (1.1.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)

View file

@ -6,6 +6,6 @@ class Api::V1::InstancesController < Api::BaseController
def show def show
expires_in 3.minutes, public: true expires_in 3.minutes, public: true
render_with_cache json: {}, serializer: REST::InstanceSerializer render_with_cache json: {}, serializer: REST::InstanceSerializer, root: 'instance'
end end
end end

View file

@ -5,6 +5,6 @@ class ManifestsController < ApplicationController
def show def show
expires_in 3.minutes, public: true expires_in 3.minutes, public: true
render json: InstancePresenter.new, serializer: ManifestSerializer render json: InstancePresenter.new, serializer: ManifestSerializer, root: 'instance'
end end
end end

View file

@ -5,7 +5,7 @@ module WellKnown
before_action :check_enabled before_action :check_enabled
def show def show
render json: {}, serializer: ProofProvider::Keybase::ConfigSerializer render json: {}, serializer: ProofProvider::Keybase::ConfigSerializer, root: 'keybase_config'
end end
private private

View file

@ -2015,6 +2015,10 @@ a.account__display-name {
.scrollable { .scrollable {
overflow: visible; overflow: visible;
@supports(display: grid) {
contain: content;
}
} }
@media screen and (min-width: $no-gap-breakpoint) { @media screen and (min-width: $no-gap-breakpoint) {

View file

@ -1,10 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
# See also: USERNAME_RE in the Account class
class UniqueUsernameValidator < ActiveModel::Validator class UniqueUsernameValidator < ActiveModel::Validator
def validate(account) def validate(account)
return if account.username.nil? return if account.username.nil?
normalized_username = account.username.downcase.delete('.') normalized_username = account.username.downcase
scope = Account.where(domain: nil).where('lower(username) = ?', normalized_username) scope = Account.where(domain: nil).where('lower(username) = ?', normalized_username)
scope = scope.where.not(id: account.id) if account.persisted? scope = scope.where.not(id: account.id) if account.persisted?

View file

@ -9,7 +9,6 @@ module.exports = {
options: { options: {
sourceMap: true, sourceMap: true,
importLoaders: 2, importLoaders: 2,
localIdentName: '[name]__[local]___[hash:base64:5]',
}, },
}, },
{ {

View file

@ -5,7 +5,8 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
disable_ddl_transaction! disable_ddl_transaction!
INCLUDED_COLUMNS = [ def migrate_columns(to_type)
included_columns = [
[:account_domain_blocks, :account_id], [:account_domain_blocks, :account_id],
[:account_domain_blocks, :id], [:account_domain_blocks, :id],
[:accounts, :id], [:accounts, :id],
@ -66,9 +67,8 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
[:web_settings, :id], [:web_settings, :id],
[:web_settings, :user_id], [:web_settings, :user_id],
] ]
INCLUDED_COLUMNS << [:deprecated_preview_cards, :id] if table_exists?(:deprecated_preview_cards) included_columns << [:deprecated_preview_cards, :id] if table_exists?(:deprecated_preview_cards)
def migrate_columns(to_type)
# Print out a warning that this will probably take a while. # Print out a warning that this will probably take a while.
say '' say ''
say 'WARNING: This migration may take a *long* time for large instances' say 'WARNING: This migration may take a *long* time for large instances'
@ -86,7 +86,7 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
sleep 1 sleep 1
end end
tables = INCLUDED_COLUMNS.map(&:first).uniq tables = included_columns.map(&:first).uniq
table_sizes = {} table_sizes = {}
# Sort tables by their size # Sort tables by their size
@ -94,7 +94,7 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
table_sizes[table] = estimate_rows_in_table(table) table_sizes[table] = estimate_rows_in_table(table)
end end
ordered_columns = INCLUDED_COLUMNS.sort_by do |col_parts| ordered_columns = included_columns.sort_by do |col_parts|
[-table_sizes[col_parts.first], col_parts.last] [-table_sizes[col_parts.first], col_parts.last]
end end

View file

@ -87,7 +87,7 @@
"classnames": "^2.2.5", "classnames": "^2.2.5",
"compression-webpack-plugin": "^3.0.0", "compression-webpack-plugin": "^3.0.0",
"cross-env": "^5.1.4", "cross-env": "^5.1.4",
"css-loader": "^2.1.1", "css-loader": "^3.1.0",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"detect-passive-events": "^1.0.2", "detect-passive-events": "^1.0.2",
"dotenv": "^8.0.0", "dotenv": "^8.0.0",

View file

@ -583,12 +583,29 @@ RSpec.describe Account, type: :model do
expect(account.valid?).to be true expect(account.valid?).to be true
end end
it 'is valid if we are creating an instance actor account with a period' do
account = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
expect(account.valid?).to be true
end
it 'is valid if we are creating a possibly-conflicting instance actor account' do
account_1 = Fabricate(:account, username: 'examplecom')
account_2 = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
expect(account_2.valid?).to be true
end
it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do
account = Fabricate.build(:account, username: 'the-doctor') account = Fabricate.build(:account, username: 'the-doctor')
account.valid? account.valid?
expect(account).to model_have_error_on_field(:username) expect(account).to model_have_error_on_field(:username)
end end
it 'is invalid if the username contains a period' do
account = Fabricate.build(:account, username: 'the.doctor')
account.valid?
expect(account).to model_have_error_on_field(:username)
end
it 'is invalid if the username is longer then 30 characters' do it 'is invalid if the username is longer then 30 characters' do
account = Fabricate.build(:account, username: Faker::Lorem.characters(31)) account = Fabricate.build(:account, username: Faker::Lorem.characters(31))
account.valid? account.valid?

View file

@ -2167,15 +2167,10 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3"
integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==
camelcase@^5.0.0: camelcase@^5.0.0, camelcase@^5.3.1:
version "5.0.0" version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
camelcase@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.2.0.tgz#e7522abda5ed94cc0489e1b8466610e88404cf45"
integrity sha512-IXFsBS2pC+X0j0N/GE7Dm7j3bsEBp+oTpb7F50dwEVX7rf3IgwO9XatnegTsDtniKCUtEJH4fSU6Asw7uoVLfQ==
caniuse-api@^3.0.0: caniuse-api@^3.0.0:
version "3.0.0" version "3.0.0"
@ -2748,22 +2743,23 @@ css-list-helpers@^1.0.1:
dependencies: dependencies:
tcomb "^2.5.0" tcomb "^2.5.0"
css-loader@^2.1.1: css-loader@^3.1.0:
version "2.1.1" version "3.1.0"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-2.1.1.tgz#d8254f72e412bb2238bb44dd674ffbef497333ea" resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.1.0.tgz#6f008b993b8ce812e6bab57f3cbfdc7a7cf28685"
integrity sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w== integrity sha512-MuL8WsF/KSrHCBCYaozBKlx+r7vIfUaDTEreo7wR7Vv3J6N0z6fqWjRk3e/6wjneitXN1r/Y9FTK1psYNOBdJQ==
dependencies: dependencies:
camelcase "^5.2.0" camelcase "^5.3.1"
icss-utils "^4.1.0" cssesc "^3.0.0"
icss-utils "^4.1.1"
loader-utils "^1.2.3" loader-utils "^1.2.3"
normalize-path "^3.0.0" normalize-path "^3.0.0"
postcss "^7.0.14" postcss "^7.0.17"
postcss-modules-extract-imports "^2.0.0" postcss-modules-extract-imports "^2.0.0"
postcss-modules-local-by-default "^2.0.6" postcss-modules-local-by-default "^3.0.2"
postcss-modules-scope "^2.1.0" postcss-modules-scope "^2.1.0"
postcss-modules-values "^2.0.0" postcss-modules-values "^3.0.0"
postcss-value-parser "^3.3.0" postcss-value-parser "^4.0.0"
schema-utils "^1.0.0" schema-utils "^2.0.0"
css-select-base-adapter@~0.1.0: css-select-base-adapter@~0.1.0:
version "0.1.1" version "0.1.1"
@ -4838,15 +4834,10 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
dependencies: dependencies:
safer-buffer ">= 2.1.2 < 3" safer-buffer ">= 2.1.2 < 3"
icss-replace-symbols@^1.1.0: icss-utils@^4.0.0, icss-utils@^4.1.1:
version "1.1.0" version "4.1.1"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467"
integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0= integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==
icss-utils@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.0.tgz#339dbbffb9f8729a243b701e1c29d4cc58c52f0e"
integrity sha512-3DEun4VOeMvSczifM3F2cKQrDQ5Pj6WKhkOq6HD4QTnDUAq8MQRxy5TX6Sy1iY6WPBe4gQ3p5vTECjbIkglkkQ==
dependencies: dependencies:
postcss "^7.0.14" postcss "^7.0.14"
@ -7617,14 +7608,15 @@ postcss-modules-extract-imports@^2.0.0:
dependencies: dependencies:
postcss "^7.0.5" postcss "^7.0.5"
postcss-modules-local-by-default@^2.0.6: postcss-modules-local-by-default@^3.0.2:
version "2.0.6" version "3.0.2"
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.6.tgz#dd9953f6dd476b5fd1ef2d8830c8929760b56e63" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz#e8a6561be914aaf3c052876377524ca90dbb7915"
integrity sha512-oLUV5YNkeIBa0yQl7EYnxMgy4N6noxmiwZStaEJUSe2xPMcdNc8WmBQuQCx18H5psYbVxz8zoHk0RAAYZXP9gA== integrity sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ==
dependencies: dependencies:
postcss "^7.0.6" icss-utils "^4.1.1"
postcss-selector-parser "^6.0.0" postcss "^7.0.16"
postcss-value-parser "^3.3.1" postcss-selector-parser "^6.0.2"
postcss-value-parser "^4.0.0"
postcss-modules-scope@^2.1.0: postcss-modules-scope@^2.1.0:
version "2.1.0" version "2.1.0"
@ -7634,12 +7626,12 @@ postcss-modules-scope@^2.1.0:
postcss "^7.0.6" postcss "^7.0.6"
postcss-selector-parser "^6.0.0" postcss-selector-parser "^6.0.0"
postcss-modules-values@^2.0.0: postcss-modules-values@^3.0.0:
version "2.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz#479b46dc0c5ca3dc7fa5270851836b9ec7152f64" resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10"
integrity sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w== integrity sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==
dependencies: dependencies:
icss-replace-symbols "^1.1.0" icss-utils "^4.0.0"
postcss "^7.0.6" postcss "^7.0.6"
postcss-normalize-charset@^4.0.1: postcss-normalize-charset@^4.0.1:
@ -7779,7 +7771,7 @@ postcss-selector-parser@^5.0.0-rc.4:
indexes-of "^1.0.1" indexes-of "^1.0.1"
uniq "^1.0.1" uniq "^1.0.1"
postcss-selector-parser@^6.0.0: postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2:
version "6.0.2" version "6.0.2"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c" resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c"
integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg== integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==
@ -7807,11 +7799,16 @@ postcss-unique-selectors@^4.0.1:
postcss "^7.0.0" postcss "^7.0.0"
uniqs "^2.0.0" uniqs "^2.0.0"
postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.1:
version "3.3.1" version "3.3.1"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==
postcss-value-parser@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d"
integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ==
postcss@^5.0.16: postcss@^5.0.16:
version "5.2.18" version "5.2.18"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5"
@ -7822,7 +7819,7 @@ postcss@^5.0.16:
source-map "^0.5.6" source-map "^0.5.6"
supports-color "^3.2.3" supports-color "^3.2.3"
postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.5, postcss@^7.0.6: postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.5, postcss@^7.0.6:
version "7.0.17" version "7.0.17"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f"
integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ==
@ -8952,6 +8949,14 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0" ajv-errors "^1.0.0"
ajv-keywords "^3.1.0" ajv-keywords "^3.1.0"
schema-utils@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.0.1.tgz#1eec2e059556af841b7f3a83b61af13d7a3f9196"
integrity sha512-HJFKJ4JixDpRur06QHwi8uu2kZbng318ahWEKgBjc0ZklcE4FDvmm2wghb448q0IRaABxIESt8vqPFvwgMB80A==
dependencies:
ajv "^6.1.0"
ajv-keywords "^3.1.0"
scroll-behavior@^0.9.1: scroll-behavior@^0.9.1:
version "0.9.9" version "0.9.9"
resolved "https://registry.yarnpkg.com/scroll-behavior/-/scroll-behavior-0.9.9.tgz#ebfe0658455b82ad885b66195215416674dacce2" resolved "https://registry.yarnpkg.com/scroll-behavior/-/scroll-behavior-0.9.9.tgz#ebfe0658455b82ad885b66195215416674dacce2"