From: Thibaut Girka Date: Wed, 2 Jan 2019 12:45:18 +0000 (+0100) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=571d219bb917cefcca7419a0ad4e3889689d5f6a;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts manually resolved: - app/services/post_status_service.rb - config/locales/simple_form.pl.yml - config/routes.rb - config/webpack/loaders/sass.js - config/webpack/shared.js - package.json - yarn.lock --- 571d219bb917cefcca7419a0ad4e3889689d5f6a diff --cc Dockerfile index 826e237c4,6ced07455..28cb5260e --- a/Dockerfile +++ b/Dockerfile @@@ -63,11 -67,8 +67,11 @@@ RUN apk -U upgrade && rm -rf /tmp/* /var/cache/apk/* COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/ +COPY stack-fix.c /lib +RUN gcc -shared -fPIC /lib/stack-fix.c -o /lib/stack-fix.so +RUN rm /lib/stack-fix.c - RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \ + RUN bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \ && bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \ && yarn install --pure-lockfile --ignore-engines \ && yarn cache clean diff --cc app/controllers/auth/confirmations_controller.rb index 2954c34da,c28c7471c..eade82e36 --- a/app/controllers/auth/confirmations_controller.rb +++ b/app/controllers/auth/confirmations_controller.rb @@@ -5,11 -5,10 +5,11 @@@ class Auth::ConfirmationsController < D before_action :set_body_classes before_action :set_user, only: [:finish_signup] + before_action :set_pack - # GET/PATCH /users/:id/finish_signup def finish_signup return unless request.patch? && params[:user] + if @user.update(user_params) @user.skip_reconfirmation! bypass_sign_in(@user) diff --cc app/models/account.rb index 99fcbf778,97beb416a..67d9a583e --- a/app/models/account.rb +++ b/app/models/account.rb @@@ -59,11 -60,8 +60,12 @@@ class Account < ApplicationRecor include Attachmentable include Paginable include AccountCounters + include DomainNormalizable + MAX_DISPLAY_NAME_LENGTH = (ENV['MAX_DISPLAY_NAME_CHARS'] || 30).to_i + MAX_NOTE_LENGTH = (ENV['MAX_BIO_CHARS'] || 500).to_i + MAX_FIELDS = (ENV['MAX_PROFILE_FIELDS'] || 4).to_i + enum protocol: [:ostatus, :activitypub] validates :username, presence: true diff --cc app/services/post_status_service.rb index d7d7770e9,eff1b1461..28ecc848d --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@@ -21,11 -21,11 +21,14 @@@ class PostStatusService < BaseServic media = validate_media!(options[:media_ids]) status = nil - text = options.delete(:spoiler_text) if text.blank? && options[:spoiler_text].present? + if text.blank? && options[:spoiler_text].present? + text = '.' + text = media.find(&:video?) ? '📹' : '🖼' if media.size > 0 + end + visibility = options[:visibility] || account.user&.setting_default_privacy + visibility = :unlisted if visibility == :public && account.silenced + ApplicationRecord.transaction do status = account.statuses.create!(text: text, media_attachments: media || [], @@@ -42,12 -42,8 +45,11 @@@ LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text? DistributionWorker.perform_async(status.id) - Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) - ActivityPub::DistributionWorker.perform_async(status.id) + + unless status.local_only? + Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) + ActivityPub::DistributionWorker.perform_async(status.id) - ActivityPub::ReplyDistributionWorker.perform_async(status.id) if status.reply? && status.thread.account.local? + end if options[:idempotency].present? redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id) diff --cc config/locales/simple_form.pl.yml index 23dd04481,b0bc564aa..1a15c5942 --- a/config/locales/simple_form.pl.yml +++ b/config/locales/simple_form.pl.yml @@@ -18,9 -19,10 +19,10 @@@ pl phrase: Zostanie wykryte nawet, gdy znajduje się za ostrzeżeniem o zawartości scopes: Wybór API, do których aplikacja będzie miała dostęp. Jeżeli wybierzesz nadrzędny zakres, nie musisz wybierać jego elementów. setting_default_language: Język Twoich wpisów może być wykrywany automatycznie, ale nie zawsze jest to dokładne + setting_display_media_show_all: Zawsze pokazuj zawartość multimedialną jako wrażliwą setting_hide_network: Informacje o tym, kto Cię śledzi i kogo śledzisz nie będą widoczne setting_noindex: Wpływa na widoczność strony profilu i Twoich wpisów - setting_theme: Zmienia wygląd Mastodona po zalogowaniu z dowolnego urządzenia. + setting_skin: Zmienia wygląd używanej odmiany Mastodona whole_word: Jeśli słowo lub fraza składa się jedynie z liter lub cyfr, filtr będzie zastosowany tylko do pełnych wystąpień imports: data: Plik CSV wyeksportowany z innej instancji Mastodona @@@ -66,7 -68,8 +68,9 @@@ setting_default_privacy: Widoczność wpisów setting_default_sensitive: Zawsze oznaczaj zawartość multimedialną jako wrażliwą setting_delete_modal: Pytaj o potwierdzenie przed usunięciem wpisu + setting_display_media_hide_all: Ukryj wszystko + setting_display_media_show_all: Pokaż wszystko + setting_favourite_modal: Pytaj o potwierdzenie przed dodaniem do ulubionych setting_hide_network: Ukryj swoją sieć setting_noindex: Nie indeksuj mojego profilu w wyszukiwarkach internetowych setting_reduce_motion: Ogranicz ruch w animacjach diff --cc config/routes.rb index 26566dfbc,6e4da48a0..cd0692817 --- a/config/routes.rb +++ b/config/routes.rb @@@ -193,7 -192,8 +195,8 @@@ Rails.application.routes.draw d resource :change_email, only: [:show, :update] resource :reset, only: [:create] resource :action, only: [:new, :create], controller: 'account_actions' - resources :statuses, only: [:index, :create, :update, :destroy] + resources :statuses, only: [:index, :show, :create, :update, :destroy] + resources :followers, only: [:index] resource :confirmation, only: [:create] do collection do diff --cc config/webpack/loaders/sass.js index 920d5350f,67a1890b8..5a96096bd --- a/config/webpack/loaders/sass.js +++ b/config/webpack/loaders/sass.js @@@ -20,7 -14,9 +14,10 @@@ module.exports = { loader: 'sass-loader', options: { + includePaths: ['app/javascript'], + fiber: require('fibers'), + implementation: require('sass'), + sourceMap: true, }, }, ], diff --cc config/webpack/shared.js index 58eab4b4c,d6199373b..938bab9f5 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@@ -4,56 -4,33 +4,56 @@@ const webpack = require('webpack') const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); - const ManifestPlugin = require('webpack-manifest-plugin'); + const AssetsManifestPlugin = require('webpack-assets-manifest'); -const extname = require('path-complete-extname'); -const { env, settings, themes, output, loadersDir } = require('./configuration.js'); -const localePackPaths = require('./generateLocalePacks'); +const { env, settings, core, flavours, output, loadersDir } = require('./configuration.js'); +const localePacks = require('./generateLocalePacks'); + +function reducePacks (data, into = {}) { + if (!data.pack) { + return into; + } + Object.keys(data.pack).reduce((map, entry) => { + const pack = data.pack[entry]; + if (!pack) { + return map; + } + const packFile = typeof pack === 'string' ? pack : pack.filename; + if (packFile) { + map[data.name ? `flavours/${data.name}/${entry}` : `core/${entry}`] = resolve(data.pack_directory, packFile); + } + return map; + }, into); + if (data.name) { + Object.keys(data.skin).reduce((map, entry) => { + const skin = data.skin[entry]; + const skinName = entry; + if (!skin) { + return map; + } + Object.keys(skin).reduce((map, entry) => { + const packFile = skin[entry]; + if (!packFile) { + return map; + } + map[`skins/${data.name}/${skinName}/${entry}`] = resolve(packFile); + return map; + }, into); + return map; + }, into); + } + return into; +} + +const entries = Object.assign( + { locales: resolve('app', 'javascript', 'locales') }, + localePacks, + reducePacks(core), + Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {}) +); -const extensionGlob = `**/*{${settings.extensions.join(',')}}*`; -const entryPath = join(settings.source_path, settings.source_entry_path); -const packPaths = sync(join(entryPath, extensionGlob)); module.exports = { - entry: Object.assign( - packPaths.reduce((map, entry) => { - const localMap = map; - const namespace = relative(join(entryPath), dirname(entry)); - localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry); - return localMap; - }, {}), - localePackPaths.reduce((map, entry) => { - const localMap = map; - localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry); - return localMap; - }, {}), - Object.keys(themes).reduce((themePaths, name) => { - themePaths[name] = resolve(join(settings.source_path, themes[name])); - return themePaths; - }, {}) - ), + entry: entries, output: { filename: '[name].js', diff --cc package.json index 05dc489fe,a7f2fd157..c2a1a30c2 --- a/package.json +++ b/package.json @@@ -25,28 -25,29 +25,30 @@@ ], "private": true, "dependencies": { - "@babel/core": "^7.0.1", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-decorators": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.0.0", - "@babel/plugin-transform-react-inline-elements": "^7.0.0", - "@babel/plugin-transform-react-jsx-self": "^7.0.0", - "@babel/plugin-transform-react-jsx-source": "^7.0.0", - "@babel/plugin-transform-runtime": "^7.0.0", - "@babel/preset-env": "^7.0.0", + "@babel/core": "^7.2.2", + "@babel/plugin-proposal-class-properties": "^7.2.3", + "@babel/plugin-proposal-decorators": "^7.2.3", + "@babel/plugin-proposal-object-rest-spread": "^7.2.0", + "@babel/plugin-syntax-dynamic-import": "^7.2.0", + "@babel/plugin-transform-react-inline-elements": "^7.2.0", + "@babel/plugin-transform-react-jsx-self": "^7.2.0", + "@babel/plugin-transform-react-jsx-source": "^7.2.0", + "@babel/plugin-transform-runtime": "^7.2.0", + "@babel/preset-env": "^7.2.3", "@babel/preset-react": "^7.0.0", - "@babel/runtime": "^7.0.0", + "@babel/runtime": "^7.2.0", + "@gfx/zopfli": "^1.0.10", "array-includes": "^3.0.3", + "atrament": "^0.2.3", - "autoprefixer": "^8.6.5", - "axios": "~0.16.2", + "autoprefixer": "^9.4.3", + "axios": "^0.18.0", "babel-core": "^7.0.0-bridge.0", - "babel-loader": "^8.0.2", + "babel-loader": "^8.0.4", "babel-plugin-lodash": "^3.3.4", "babel-plugin-preval": "^3.0.1", - "babel-plugin-react-intl": "^3.0.0", - "babel-plugin-transform-react-remove-prop-types": "^0.4.15", + "babel-plugin-react-intl": "^3.0.1", + "babel-plugin-transform-react-remove-prop-types": "^0.4.21", + "babel-runtime": "^6.26.0", "classnames": "^2.2.5", "compression-webpack-plugin": "^2.0.0", "cross-env": "^5.1.4", @@@ -57,9 -59,9 +60,10 @@@ "es6-symbol": "^3.1.1", "escape-html": "^1.0.3", "exif-js": "^2.3.0", - "express": "^4.16.2", + "express": "^4.16.4", + "favico.js": "^0.3.10", - "file-loader": "^2.0.0", + "fibers": "^3.1.1", + "file-loader": "^3.0.1", "font-awesome": "^4.7.0", "glob": "^7.1.1", "history": "^4.7.2", diff --cc spec/validators/status_length_validator_spec.rb index 9355c7e3f,11e55f933..62791cd2f --- a/spec/validators/status_length_validator_spec.rb +++ b/spec/validators/status_length_validator_spec.rb @@@ -4,12 -4,20 +4,21 @@@ require 'rails_helper describe StatusLengthValidator do describe '#validate' do - it 'does not add errors onto remote statuses' - it 'does not add errors onto local reblogs' + it 'does not add errors onto remote statuses' do + status = double(local?: false) + subject.validate(status) + expect(status).not_to receive(:errors) + end + + it 'does not add errors onto local reblogs' do + status = double(local?: false, reblog?: true) + subject.validate(status) + expect(status).not_to receive(:errors) + end - it 'adds an error when content warning is over 500 characters' do - status = double(spoiler_text: 'a' * 520, text: '', errors: double(add: nil), local?: true, reblog?: false) + it 'adds an error when content warning is over MAX_CHARS characters' do + chars = StatusLengthValidator::MAX_CHARS + 1 + status = double(spoiler_text: 'a' * chars, text: '', errors: double(add: nil), local?: true, reblog?: false) subject.validate(status) expect(status.errors).to have_received(:add) end diff --cc yarn.lock index f055be0bf,0fd1924fe..9d50fe8c7 --- a/yarn.lock +++ b/yarn.lock @@@ -1302,26 -1272,17 +1272,21 @@@ atob@^2.1.1 resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +atrament@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/atrament/-/atrament-0.2.3.tgz#6ccbc0daa6d3f25e5aeaeb31befeb78e86980348" + - autoprefixer@^8.6.5: - version "8.6.5" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.6.5.tgz#343f3d193ed568b3208e00117a1b96eb691d4ee9" - integrity sha512-PLWJN3Xo/rycNkx+mp8iBDMTm3FeWe4VmYaZDSqL5QQB9sLsQkG5k8n+LNDFnhh9kdq2K+egL/icpctOmDHwig== + autoprefixer@^9.4.3: + version "9.4.3" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.4.3.tgz#c97384a8fd80477b78049163a91bbc725d9c41d9" + integrity sha512-/XSnzDepRkAU//xLcXA/lUWxpsBuw0WiriAHOqnxkuCtzLhaz+fL4it4gp20BQ8n5SyLzK/FOc7A0+u/rti2FQ== dependencies: - browserslist "^3.2.8" - caniuse-lite "^1.0.30000864" + browserslist "^4.3.6" + caniuse-lite "^1.0.30000921" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^6.0.23" - postcss-value-parser "^3.2.3" - - aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" - integrity sha1-FDQt0428yU0OW4fXY81jYSwOeU8= + postcss "^7.0.6" + postcss-value-parser "^3.3.1" aws-sign2@~0.7.0: version "0.7.0" @@@ -3640,14 -3617,10 +3621,14 @@@ fast-levenshtein@~2.0.4 integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastparse@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" - integrity sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg= + version "1.1.2" + resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9" + integrity sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ== +favico.js@^0.3.10: + version "0.3.10" + resolved "https://registry.yarnpkg.com/favico.js/-/favico.js-0.3.10.tgz#80586e27a117f24a8d51c18a99bdc714d4339301" + faye-websocket@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4"