diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 190b5038c..000000000 --- a/.babelrc +++ /dev/null @@ -1,66 +0,0 @@ -{ - "presets": [ - "react", - [ - "env", - { - "exclude": ["transform-async-to-generator", "transform-regenerator"], - "loose": true, - "modules": false, - "targets": { - "browsers": ["last 2 versions", "IE >= 11", "iOS >= 9"] - } - } - ] - ], - "plugins": [ - "syntax-dynamic-import", - ["transform-object-rest-spread", { "useBuiltIns": true }], - "transform-decorators-legacy", - "transform-class-properties", - [ - "react-intl", - { - "messagesDir": "./build/messages" - } - ], - "preval" - ], - "env": { - "development": { - "plugins": [ - "transform-react-jsx-source", - "transform-react-jsx-self" - ] - }, - "production": { - "plugins": [ - "lodash", - [ - "transform-react-remove-prop-types", - { - "mode": "remove", - "removeImport": true, - "additionalLibraries": [ - "react-immutable-proptypes" - ] - } - ], - "transform-react-inline-elements", - [ - "transform-runtime", - { - "helpers": true, - "polyfill": false, - "regenerator": false - } - ] - ] - }, - "test": { - "plugins": [ - "transform-es2015-modules-commonjs" - ] - } - } -} diff --git a/.env.vagrant b/.env.vagrant index 04b889d00..f3b54f6e3 100644 --- a/.env.vagrant +++ b/.env.vagrant @@ -1,2 +1,2 @@ VAGRANT=true -LOCAL_DOMAIN=mastodon.dev \ No newline at end of file +LOCAL_DOMAIN=mastodon.local diff --git a/.rubocop.yml b/.rubocop.yml index 4ba5903bd..59e8a757a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -77,6 +77,11 @@ Rails/SkipsModelValidations: Rails/HttpStatus: Enabled: false +Rails/Exit: + Exclude: + - 'lib/mastodon/*' + - 'lib/cli' + Style/ClassAndModuleChildren: Enabled: false diff --git a/Gemfile b/Gemfile index 356081dbf..27d65f272 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'devise', '~> 4.4' gem 'devise-two-factor', '~> 3.0' group :pam_authentication, optional: true do - gem 'devise_pam_authenticatable2', '~> 9.1' + gem 'devise_pam_authenticatable2', '~> 9.2' end gem 'net-ldap', '~> 0.10' @@ -88,7 +88,7 @@ gem 'tty-command', '~> 0.8', require: false gem 'tty-prompt', '~> 0.16', require: false gem 'twitter-text', '~> 1.14' gem 'tzinfo-data', '~> 1.2018' -gem 'webpacker', '~> 3.4' +gem 'webpacker', '~> 3.5' gem 'webpush' gem 'json-ld', '~> 2.2' diff --git a/Gemfile.lock b/Gemfile.lock index 8eda89d12..e4e1c69df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -174,7 +174,7 @@ GEM devise (~> 4.0) railties (< 5.3) rotp (~> 2.0) - devise_pam_authenticatable2 (9.1.1) + devise_pam_authenticatable2 (9.2.0) devise (>= 4.0.0) rpam2 (~> 4.0) diff-lcs (1.3) @@ -629,7 +629,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - webpacker (3.4.3) + webpacker (3.5.5) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) @@ -671,7 +671,7 @@ DEPENDENCIES derailed_benchmarks devise (~> 4.4) devise-two-factor (~> 3.0) - devise_pam_authenticatable2 (~> 9.1) + devise_pam_authenticatable2 (~> 9.2) doorkeeper (~> 5.0) dotenv-rails (~> 2.2, < 2.3) fabrication (~> 2.20) @@ -761,7 +761,7 @@ DEPENDENCIES twitter-text (~> 1.14) tzinfo-data (~> 1.2018) webmock (~> 3.3) - webpacker (~> 3.4) + webpacker (~> 3.5) webpush RUBY VERSION diff --git a/Vagrantfile b/Vagrantfile index ee45d1d16..a30ba2b34 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -85,6 +85,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider :virtualbox do |vb| vb.name = "mastodon" vb.customize ["modifyvm", :id, "--memory", "4096"] + # Increase the number of CPUs. Uncomment and adjust to + # increase performance + # vb.customize ["modifyvm", :id, "--cpus", "3"] # Disable VirtualBox DNS proxy to skip long-delay IPv6 resolutions. # https://github.com/mitchellh/vagrant/issues/1172 @@ -97,19 +100,22 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end - config.vm.hostname = "mastodon.dev" - # This uses the vagrant-hostsupdater plugin, and lets you - # access the development site at http://mastodon.dev. + # access the development site at http://mastodon.local. + # If you change it, also change it in .env.vagrant before provisioning + # the vagrant server to update the development build. + # # To install: # $ vagrant plugin install vagrant-hostsupdater + config.vm.hostname = "mastodon.local" + if defined?(VagrantPlugins::HostsUpdater) config.vm.network :private_network, ip: "192.168.42.42", nictype: "virtio" config.hostsupdater.remove_on_suspend = false end if config.vm.networks.any? { |type, options| type == :private_network } - config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp'] + config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'actimeo=1'] else config.vm.synced_folder ".", "/vagrant" end diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index f4401b3dd..d4a659409 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -133,7 +133,7 @@ class Auth::SessionsController < Devise::SessionsController def clear_site_data return if continue_after? - # Should be '"*"' but that doen't work in Chrome (neither does '"executionContexts"') + # Should be '"*"' but that doesn't work in Chrome (neither does '"executionContexts"') # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data response.headers['Clear-Site-Data'] = '"cache", "cookies"' end diff --git a/app/helpers/admin/account_moderation_notes_helper.rb b/app/helpers/admin/account_moderation_notes_helper.rb index 25586fbba..4d8f0352e 100644 --- a/app/helpers/admin/account_moderation_notes_helper.rb +++ b/app/helpers/admin/account_moderation_notes_helper.rb @@ -4,7 +4,7 @@ module Admin::AccountModerationNotesHelper def admin_account_link_to(account) return if account.nil? - link_to admin_account_path(account.id), class: name_tag_classes(account) do + link_to admin_account_path(account.id), class: name_tag_classes(account), title: account.acct do safe_join([ image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'), content_tag(:span, account.acct, class: 'username'), @@ -15,7 +15,7 @@ module Admin::AccountModerationNotesHelper def admin_account_inline_link_to(account) return if account.nil? - link_to admin_account_path(account.id), class: name_tag_classes(account, true) do + link_to admin_account_path(account.id), class: name_tag_classes(account, true), title: account.acct do content_tag(:span, account.acct, class: 'username') end end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index f5b501235..ba7c443c2 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -7,13 +7,13 @@ module HomeHelper } end - def account_link_to(account, button = '') + def account_link_to(account, button = '', size: 36, path: nil) content_tag(:div, class: 'account') do content_tag(:div, class: 'account__wrapper') do section = if account.nil? content_tag(:div, class: 'account__display-name') do content_tag(:div, class: 'account__avatar-wrapper') do - content_tag(:div, '', class: 'account__avatar', style: "background-image: url(#{full_asset_url('avatars/original/missing.png', skip_pipeline: true)})") + content_tag(:div, '', class: 'account__avatar', style: "width: #{size}px; height: #{size}px; background-size: #{size}px #{size}px; background-image: url(#{full_asset_url('avatars/original/missing.png', skip_pipeline: true)})") end + content_tag(:span, class: 'display-name') do content_tag(:strong, t('about.contact_missing')) + @@ -21,9 +21,9 @@ module HomeHelper end end else - link_to(TagManager.instance.url_for(account), class: 'account__display-name') do + link_to(path || TagManager.instance.url_for(account), class: 'account__display-name') do content_tag(:div, class: 'account__avatar-wrapper') do - content_tag(:div, '', class: 'account__avatar', style: "background-image: url(#{account.avatar.url})") + content_tag(:div, '', class: 'account__avatar', style: "width: #{size}px; height: #{size}px; background-size: #{size}px #{size}px; background-image: url(#{account.avatar.url})") end + content_tag(:span, class: 'display-name') do content_tag(:bdi) do @@ -48,4 +48,12 @@ module HomeHelper '1+' end end + + def custom_field_classes(field) + if field.verified? + 'verified' + else + 'emojify' + end + end end diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index e48fcb9b1..377c899dc 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -50,3 +50,27 @@ delegate(document, '#account_locked', 'change', ({ target }) => { lock.style.display = 'none'; } }); + +delegate(document, '.input-copy input', 'click', ({ target }) => { + target.select(); +}); + +delegate(document, '.input-copy button', 'click', ({ target }) => { + const input = target.parentNode.querySelector('input'); + + input.focus(); + input.select(); + + try { + if (document.execCommand('copy')) { + input.blur(); + target.parentNode.classList.add('copied'); + + setTimeout(() => { + target.parentNode.classList.remove('copied'); + }, 700); + } + } catch (err) { + console.error(err); + } +}); diff --git a/app/javascript/mastodon/actions/dropdown_menu.js b/app/javascript/mastodon/actions/dropdown_menu.js index 217ba4e74..14f2939c7 100644 --- a/app/javascript/mastodon/actions/dropdown_menu.js +++ b/app/javascript/mastodon/actions/dropdown_menu.js @@ -1,8 +1,8 @@ export const DROPDOWN_MENU_OPEN = 'DROPDOWN_MENU_OPEN'; export const DROPDOWN_MENU_CLOSE = 'DROPDOWN_MENU_CLOSE'; -export function openDropdownMenu(id, placement) { - return { type: DROPDOWN_MENU_OPEN, id, placement }; +export function openDropdownMenu(id, placement, keyboard) { + return { type: DROPDOWN_MENU_OPEN, id, placement, keyboard }; } export function closeDropdownMenu(id) { diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap index c3f018d90..5c04e0979 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap @@ -3,7 +3,6 @@ exports[`