diff --git a/.codeclimate.yml b/.codeclimate.yml index 47e3e6ab9..21e6b33bf 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -27,6 +27,7 @@ plugins: enabled: true eslint: enabled: true + channel: eslint-4 rubocop: enabled: true scss-lint: diff --git a/.eslintrc.yml b/.eslintrc.yml index 7c6da9d57..cf276a16f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -17,11 +17,9 @@ plugins: parserOptions: sourceType: module ecmaFeatures: - arrowFunctions: true + experimentalObjectRestSpread: true jsx: true - destructuring: true - modules: true - spread: true + ecmaVersion: 2018 settings: import/extensions: @@ -109,6 +107,7 @@ rules: react/self-closing-comp: error jsx-a11y/accessible-emoji: warn + jsx-a11y/alt-text: warn jsx-a11y/anchor-has-content: warn jsx-a11y/aria-activedescendant-has-tabindex: warn jsx-a11y/aria-props: warn @@ -119,16 +118,22 @@ rules: jsx-a11y/href-no-hash: warn jsx-a11y/html-has-lang: warn jsx-a11y/iframe-has-title: warn - jsx-a11y/img-has-alt: warn jsx-a11y/img-redundant-alt: warn + jsx-a11y/interactive-supports-focus: warn jsx-a11y/label-has-for: off jsx-a11y/mouse-events-have-key-events: warn jsx-a11y/no-access-key: warn jsx-a11y/no-distracting-elements: warn + jsx-a11y/no-noninteractive-element-interactions: + - warn + - handlers: + - onClick jsx-a11y/no-onchange: warn jsx-a11y/no-redundant-roles: warn - jsx-a11y/onclick-has-focus: warn - jsx-a11y/onclick-has-role: warn + jsx-a11y/no-static-element-interactions: + - warn + - handlers: + - onClick jsx-a11y/role-has-required-aria-props: warn jsx-a11y/role-supports-aria-props: off jsx-a11y/scope: warn diff --git a/.ruby-version b/.ruby-version index 8e8299dcc..437459cd9 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.2 +2.5.0 diff --git a/.travis.yml b/.travis.yml index 777ca581c..35fc49dde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,10 @@ cache: - public/packs-test - tmp/cache/babel-loader dist: trusty -sudo: required +sudo: false +branches: + only: + - master notifications: email: false @@ -37,8 +40,8 @@ addons: - yarn rvm: - - 2.3.4 - 2.4.2 + - 2.5.0 services: - redis-server @@ -49,8 +52,7 @@ install: - yarn install before_script: - - bundle exec rake parallel:create parallel:load_schema parallel:prepare - - bundle exec rails assets:precompile + - ./bin/rails parallel:create parallel:load_schema parallel:prepare assets:precompile - ln -s /usr/bin/x86_64-linux-gnu-g++-6 "$HOME/g++" script: diff --git a/Dockerfile b/Dockerfile index 7cca02ecf..765df58c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.4.2-alpine3.6 +FROM ruby:2.5.0-alpine3.7 LABEL maintainer="https://github.com/tootsuite/mastodon" \ description="A GNU Social-compatible microblogging server" @@ -40,6 +40,7 @@ RUN apk -U upgrade \ protobuf \ su-exec \ tini \ + tzdata \ && update-ca-certificates \ && mkdir -p /tmp/src /opt \ && wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ diff --git a/Gemfile b/Gemfile index a5bf2daff..eaa1d29de 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # frozen_string_literal: true source 'https://rubygems.org' -ruby '>= 2.3.0', '< 2.5.0' +ruby '>= 2.3.0', '< 2.6.0' gem 'pkg-config', '~> 1.2' @@ -28,15 +28,15 @@ gem 'browser' gem 'charlock_holmes', '~> 0.7.5' gem 'iso-639' gem 'cld3', '~> 3.2.0' -gem 'devise', '~> 4.3' +gem 'devise', '~> 4.4' gem 'devise-two-factor', '~> 3.0' gem 'doorkeeper', '~> 4.2' gem 'fast_blank', '~> 1.0' -gem 'goldfinger', '~> 2.0' +gem 'goldfinger', '~> 2.1' gem 'hiredis', '~> 0.6' gem 'redis-namespace', '~> 1.5' gem 'htmlentities', '~> 4.3' -gem 'http', '~> 2.2' +gem 'http', '~> 3.0' gem 'http_accept_language', '~> 2.1' gem 'httplog', '~> 0.99' gem 'idn-ruby', require: 'idn' @@ -49,6 +49,7 @@ gem 'oj', '~> 3.3' gem 'ostatus2', '~> 2.0' gem 'ox', '~> 2.8' gem 'pundit', '~> 1.1' +gem 'premailer-rails' gem 'rack-attack', '~> 5.0' gem 'rack-cors', '~> 0.4', require: 'rack/cors' gem 'rack-timeout', '~> 0.4' diff --git a/Gemfile.lock b/Gemfile.lock index f3887b2b8..b116318a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,7 +70,7 @@ GEM coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - binding_of_caller (0.7.3) + binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) bootsnap (1.1.5) msgpack (~> 1.0) @@ -110,7 +110,7 @@ GEM activesupport charlock_holmes (0.7.5) chunky_png (1.3.8) - cld3 (3.2.1) + cld3 (3.2.2) ffi (>= 1.1.0, < 1.10.0) climate_control (0.2.0) cocaine (0.5.8) @@ -122,8 +122,10 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.3) + css_parser (1.6.0) + addressable debug_inspector (0.0.3) - devise (4.3.0) + devise (4.4.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 5.2) @@ -179,9 +181,9 @@ GEM ruby-progressbar (~> 1.4) globalid (0.4.1) activesupport (>= 4.2.0) - goldfinger (2.0.1) + goldfinger (2.1.0) addressable (~> 2.5) - http (~> 2.2) + http (~> 3.0) nokogiri (~> 1.8) oj (~> 3.0) hamlit (2.8.5) @@ -200,14 +202,14 @@ GEM hiredis (0.6.1) hkdf (0.3.0) htmlentities (4.3.4) - http (2.2.2) + http (3.0.0) addressable (~> 2.3) http-cookie (~> 1.0) - http-form_data (~> 1.0.1) + http-form_data (>= 2.0.0.pre.pre2, < 3) http_parser.rb (~> 0.6.0) http-cookie (1.0.3) domain_name (~> 0.5) - http-form_data (1.0.3) + http-form_data (2.0.0) http_accept_language (2.1.1) http_parser.rb (0.6.0) httplog (0.99.7) @@ -298,12 +300,12 @@ GEM concurrent-ruby (~> 1.0.0) sidekiq (>= 3.5.0) statsd-ruby (~> 1.2.0) - oj (3.3.9) + oj (3.3.10) orm_adapter (0.5.0) - ostatus2 (2.0.2) - addressable (~> 2.4) - http (~> 2.0) - nokogiri (~> 1.6) + ostatus2 (2.0.3) + addressable (~> 2.5) + http (~> 3.0) + nokogiri (~> 1.8) ox (2.8.2) paperclip (5.1.0) activemodel (>= 4.2.0) @@ -324,6 +326,13 @@ GEM activerecord pkg-config (1.2.8) powerpack (0.1.1) + premailer (1.11.1) + addressable + css_parser (>= 1.6.0) + htmlentities (>= 4.0.0) + premailer-rails (1.10.1) + actionmailer (>= 3, < 6) + premailer (~> 1.7, >= 1.7.9) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -559,7 +568,7 @@ DEPENDENCIES charlock_holmes (~> 0.7.5) cld3 (~> 3.2.0) climate_control (~> 0.2) - devise (~> 4.3) + devise (~> 4.4) devise-two-factor (~> 3.0) doorkeeper (~> 4.2) dotenv-rails (~> 2.2) @@ -570,11 +579,11 @@ DEPENDENCIES fog-local (~> 0.4) fog-openstack (~> 0.1) fuubar (~> 2.2) - goldfinger (~> 2.0) + goldfinger (~> 2.1) hamlit-rails (~> 0.2) hiredis (~> 0.6) htmlentities (~> 4.3) - http (~> 2.2) + http (~> 3.0) http_accept_language (~> 2.1) httplog (~> 0.99) i18n-tasks (~> 0.9) @@ -600,6 +609,7 @@ DEPENDENCIES pg (~> 0.20) pghero (~> 1.7) pkg-config (~> 1.2) + premailer-rails pry-rails (~> 0.3) puma (~> 3.10) pundit (~> 1.1) @@ -639,7 +649,7 @@ DEPENDENCIES webpush RUBY VERSION - ruby 2.4.2p198 + ruby 2.5.0p0 BUNDLED WITH 1.16.1 diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index 76553a162..7d0bc74d3 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -28,7 +28,7 @@ class ActivityPub::InboxesController < Api::BaseController def upgrade_account if signed_request_account.ostatus? signed_request_account.update(last_webfingered_at: nil) - ResolveRemoteAccountWorker.perform_async(signed_request_account.acct) + ResolveAccountWorker.perform_async(signed_request_account.acct) end Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed? diff --git a/app/controllers/api/v1/timelines/home_controller.rb b/app/controllers/api/v1/timelines/home_controller.rb index db6cd8568..bbbcf7f90 100644 --- a/app/controllers/api/v1/timelines/home_controller.rb +++ b/app/controllers/api/v1/timelines/home_controller.rb @@ -9,7 +9,11 @@ class Api::V1::Timelines::HomeController < Api::BaseController def show @statuses = load_statuses - render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id) + + render json: @statuses, + each_serializer: REST::StatusSerializer, + relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id), + status: regeneration_in_progress? ? 206 : 200 end private @@ -57,4 +61,8 @@ class Api::V1::Timelines::HomeController < Api::BaseController def pagination_since_id @statuses.first.id end + + def regeneration_in_progress? + Redis.current.exists("account:#{current_account.id}:regeneration") + end end diff --git a/app/controllers/api/web/push_subscriptions_controller.rb b/app/controllers/api/web/push_subscriptions_controller.rb index 52e250d02..68ccbd5e2 100644 --- a/app/controllers/api/web/push_subscriptions_controller.rb +++ b/app/controllers/api/web/push_subscriptions_controller.rb @@ -4,6 +4,7 @@ class Api::Web::PushSubscriptionsController < Api::BaseController respond_to :json before_action :require_user! + protect_from_forgery with: :exception def create params.require(:subscription).require(:endpoint) diff --git a/app/controllers/authorize_follows_controller.rb b/app/controllers/authorize_follows_controller.rb index 7afe664d1..775d5f23f 100644 --- a/app/controllers/authorize_follows_controller.rb +++ b/app/controllers/authorize_follows_controller.rb @@ -41,7 +41,7 @@ class AuthorizeFollowsController < ApplicationController end def account_from_remote_follow - ResolveRemoteAccountService.new.call(acct_without_prefix) + ResolveAccountService.new.call(acct_without_prefix) end def acct_param_is_url? diff --git a/app/controllers/concerns/signature_verification.rb b/app/controllers/concerns/signature_verification.rb index 2baafb5bf..f289228d3 100644 --- a/app/controllers/concerns/signature_verification.rb +++ b/app/controllers/concerns/signature_verification.rb @@ -114,7 +114,7 @@ module SignatureVerification def account_from_key_id(key_id) if key_id.start_with?('acct:') - ResolveRemoteAccountService.new.call(key_id.gsub(/\Aacct:/, '')) + ResolveAccountService.new.call(key_id.gsub(/\Aacct:/, '')) elsif !ActivityPub::TagManager.instance.local_uri?(key_id) account = ActivityPub::TagManager.instance.uri_to_resource(key_id, Account) account ||= ActivityPub::FetchRemoteKeyService.new.call(key_id, id: false) diff --git a/app/controllers/concerns/user_tracking_concern.rb b/app/controllers/concerns/user_tracking_concern.rb index 1e3132941..be10705fc 100644 --- a/app/controllers/concerns/user_tracking_concern.rb +++ b/app/controllers/concerns/user_tracking_concern.rb @@ -3,7 +3,6 @@ module UserTrackingConcern extend ActiveSupport::Concern - REGENERATE_FEED_DAYS = 14 UPDATE_SIGN_IN_HOURS = 24 included do @@ -14,25 +13,10 @@ module UserTrackingConcern def set_user_activity return unless user_needs_sign_in_update? - - # Mark as signed-in today current_user.update_tracked_fields!(request) - ActivityTracker.record('activity:logins', current_user.id) - - # Regenerate feed if needed - regenerate_feed! if user_needs_feed_update? end def user_needs_sign_in_update? user_signed_in? && (current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago) end - - def user_needs_feed_update? - current_user.last_sign_in_at < REGENERATE_FEED_DAYS.days.ago - end - - def regenerate_feed! - Redis.current.setnx("account:#{current_user.account_id}:regeneration", true) == 1 && Redis.current.expire("account:#{current_user.account_id}:regeneration", 3_600 * 24) - RegenerationWorker.perform_async(current_user.account_id) - end end diff --git a/app/controllers/settings/two_factor_authentication/confirmations_controller.rb b/app/controllers/settings/two_factor_authentication/confirmations_controller.rb index 4cf62db13..8d534960d 100644 --- a/app/controllers/settings/two_factor_authentication/confirmations_controller.rb +++ b/app/controllers/settings/two_factor_authentication/confirmations_controller.rb @@ -6,6 +6,7 @@ module Settings layout 'admin' before_action :authenticate_user! + before_action :ensure_otp_secret def new prepare_two_factor_form @@ -38,6 +39,10 @@ module Settings @provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Rails.configuration.x.local_domain) @qrcode = RQRCode::QRCode.new(@provision_url) end + + def ensure_otp_secret + redirect_to settings_two_factor_authentication_path unless current_user.otp_secret + end end end end diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb index fc2469dea..3ec831a72 100644 --- a/app/controllers/shares_controller.rb +++ b/app/controllers/shares_controller.rb @@ -14,13 +14,14 @@ class SharesController < ApplicationController private def initial_state_params + text = [params[:title], params[:text], params[:url]].compact.join(' ') { settings: Web::Setting.find_by(user: current_user)&.data || {}, push_subscription: current_account.user.web_push_subscription(current_session), current_account: current_account, token: current_session.token, admin: Account.find_local(Setting.site_contact_username), - text: params[:text], + text: text, } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8ed5c8bda..bab4615a1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -22,10 +22,18 @@ module ApplicationHelper end def add_rtl_body_class(other_classes) - other_classes = "#{other_classes} rtl" if [:ar, :fa, :he].include?(I18n.locale) + other_classes = "#{other_classes} rtl" if locale_direction == 'rtl' other_classes end + def locale_direction + if [:ar, :fa, :he].include?(I18n.locale) + 'rtl' + else + 'ltr' + end + end + def favicon_path env_suffix = Rails.env.production? ? '' : '-dev' "/favicon#{env_suffix}.ico" diff --git a/app/helpers/instance_helper.rb b/app/helpers/instance_helper.rb index 70027cca9..22a19c52b 100644 --- a/app/helpers/instance_helper.rb +++ b/app/helpers/instance_helper.rb @@ -6,6 +6,6 @@ module InstanceHelper end def site_hostname - Rails.configuration.x.local_domain + @site_hostname ||= Addressable::URI.parse("//#{Rails.configuration.x.local_domain}").display_uri.host end end diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb new file mode 100644 index 000000000..b7e3a8da3 --- /dev/null +++ b/app/helpers/mailer_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +module MailerHelper +end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index a63eb5e43..a2f5917f9 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -16,6 +16,7 @@ module SettingsHelper he: 'עברית', hr: 'Hrvatski', hu: 'Magyar', + hy: 'Հայերեն', id: 'Bahasa Indonesia', io: 'Ido', it: 'Italiano', diff --git a/app/javascript/images/elephant-friend-1.png b/app/javascript/images/elephant-friend-1.png deleted file mode 100644 index 2b2383330..000000000 Binary files a/app/javascript/images/elephant-friend-1.png and /dev/null differ diff --git a/app/javascript/images/elephant-friend.png b/app/javascript/images/elephant-friend.png deleted file mode 100644 index 3c5145ba9..000000000 Binary files a/app/javascript/images/elephant-friend.png and /dev/null differ diff --git a/app/javascript/images/elephant_ui_disappointed.svg b/app/javascript/images/elephant_ui_disappointed.svg new file mode 100644 index 000000000..580c15a13 --- /dev/null +++ b/app/javascript/images/elephant_ui_disappointed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/images/elephant_ui_greeting.svg b/app/javascript/images/elephant_ui_greeting.svg new file mode 100644 index 000000000..f3eb4b142 --- /dev/null +++ b/app/javascript/images/elephant_ui_greeting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/images/elephant_ui_plane.svg b/app/javascript/images/elephant_ui_plane.svg new file mode 100644 index 000000000..a2624d170 --- /dev/null +++ b/app/javascript/images/elephant_ui_plane.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/images/elephant_ui_working.svg b/app/javascript/images/elephant_ui_working.svg new file mode 100644 index 000000000..8ba475db0 --- /dev/null +++ b/app/javascript/images/elephant_ui_working.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/images/icon_cached.svg b/app/javascript/images/icon_cached.svg new file mode 100644 index 000000000..1087c4350 --- /dev/null +++ b/app/javascript/images/icon_cached.svg @@ -0,0 +1,2 @@ + + diff --git a/app/javascript/images/icon_done.svg b/app/javascript/images/icon_done.svg new file mode 100644 index 000000000..446af14d9 --- /dev/null +++ b/app/javascript/images/icon_done.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/icon_email.svg b/app/javascript/images/icon_email.svg new file mode 100644 index 000000000..6d0ad9d9b --- /dev/null +++ b/app/javascript/images/icon_email.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/icon_grade.svg b/app/javascript/images/icon_grade.svg new file mode 100644 index 000000000..f48b46889 --- /dev/null +++ b/app/javascript/images/icon_grade.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/icon_lock_open.svg b/app/javascript/images/icon_lock_open.svg new file mode 100644 index 000000000..3288b46d6 --- /dev/null +++ b/app/javascript/images/icon_lock_open.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/icon_person_add.svg b/app/javascript/images/icon_person_add.svg new file mode 100644 index 000000000..068b8ae7c --- /dev/null +++ b/app/javascript/images/icon_person_add.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/icon_reply.svg b/app/javascript/images/icon_reply.svg new file mode 100644 index 000000000..cf6a09abc --- /dev/null +++ b/app/javascript/images/icon_reply.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/javascript/images/logo_transparent.svg b/app/javascript/images/logo_transparent.svg new file mode 100644 index 000000000..abd6d1f67 --- /dev/null +++ b/app/javascript/images/logo_transparent.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/images/mailer/icon_cached.png b/app/javascript/images/mailer/icon_cached.png new file mode 100644 index 000000000..210833d34 Binary files /dev/null and b/app/javascript/images/mailer/icon_cached.png differ diff --git a/app/javascript/images/mailer/icon_done.png b/app/javascript/images/mailer/icon_done.png new file mode 100644 index 000000000..0d2ef0cb8 Binary files /dev/null and b/app/javascript/images/mailer/icon_done.png differ diff --git a/app/javascript/images/mailer/icon_email.png b/app/javascript/images/mailer/icon_email.png new file mode 100644 index 000000000..aae9d2bb9 Binary files /dev/null and b/app/javascript/images/mailer/icon_email.png differ diff --git a/app/javascript/images/mailer/icon_grade.png b/app/javascript/images/mailer/icon_grade.png new file mode 100644 index 000000000..895b57d0a Binary files /dev/null and b/app/javascript/images/mailer/icon_grade.png differ diff --git a/app/javascript/images/mailer/icon_lock_open.png b/app/javascript/images/mailer/icon_lock_open.png new file mode 100644 index 000000000..9f62eadc2 Binary files /dev/null and b/app/javascript/images/mailer/icon_lock_open.png differ diff --git a/app/javascript/images/mailer/icon_person_add.png b/app/javascript/images/mailer/icon_person_add.png new file mode 100644 index 000000000..3453060ae Binary files /dev/null and b/app/javascript/images/mailer/icon_person_add.png differ diff --git a/app/javascript/images/mailer/icon_reply.png b/app/javascript/images/mailer/icon_reply.png new file mode 100644 index 000000000..8bce4955c Binary files /dev/null and b/app/javascript/images/mailer/icon_reply.png differ diff --git a/app/javascript/images/mailer/logo_full.png b/app/javascript/images/mailer/logo_full.png new file mode 100644 index 000000000..1c4f33287 Binary files /dev/null and b/app/javascript/images/mailer/logo_full.png differ diff --git a/app/javascript/images/mailer/logo_transparent.png b/app/javascript/images/mailer/logo_transparent.png new file mode 100644 index 000000000..8fda4f67f Binary files /dev/null and b/app/javascript/images/mailer/logo_transparent.png differ diff --git a/app/javascript/images/mastodon-not-found.png b/app/javascript/images/mastodon-not-found.png deleted file mode 100644 index 76108d41f..000000000 Binary files a/app/javascript/images/mastodon-not-found.png and /dev/null differ diff --git a/app/javascript/images/mastodon-ui.png b/app/javascript/images/mastodon-ui.png deleted file mode 100644 index a1fb642a0..000000000 Binary files a/app/javascript/images/mastodon-ui.png and /dev/null differ diff --git a/app/javascript/images/wave-compose-standalone.png b/app/javascript/images/wave-compose-standalone.png deleted file mode 100644 index 287ee639b..000000000 Binary files a/app/javascript/images/wave-compose-standalone.png and /dev/null differ diff --git a/app/javascript/images/wave-drawer.png b/app/javascript/images/wave-drawer.png deleted file mode 100644 index ca9f9e1d8..000000000 Binary files a/app/javascript/images/wave-drawer.png and /dev/null differ diff --git a/app/javascript/images/wave-modal.png b/app/javascript/images/wave-modal.png deleted file mode 100644 index 88818a6d7..000000000 Binary files a/app/javascript/images/wave-modal.png and /dev/null differ diff --git a/app/javascript/mastodon/actions/push_notifications/registerer.js b/app/javascript/mastodon/actions/push_notifications/registerer.js index 5f47a5501..51e68cad1 100644 --- a/app/javascript/mastodon/actions/push_notifications/registerer.js +++ b/app/javascript/mastodon/actions/push_notifications/registerer.js @@ -1,6 +1,7 @@ import api from '../../api'; import { pushNotificationsSetting } from '../../settings'; import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; +import { me } from '../../initial_state'; // Taken from https://www.npmjs.com/package/web-push const urlBase64ToUint8Array = (base64String) => { @@ -35,7 +36,7 @@ const subscribe = (registration) => const unsubscribe = ({ registration, subscription }) => subscription ? subscription.unsubscribe().then(() => registration) : registration; -const sendSubscriptionToBackend = (getState, subscription, me) => { +const sendSubscriptionToBackend = (getState, subscription) => { const params = { subscription }; if (me) { @@ -54,7 +55,6 @@ const supportsPushNotifications = ('serviceWorker' in navigator && 'PushManager' export function register () { return (dispatch, getState) => { dispatch(setBrowserSupport(supportsPushNotifications)); - const me = getState().getIn(['meta', 'me']); if (me && !pushNotificationsSetting.get(me)) { const alerts = getState().getIn(['push_notifications', 'alerts']); @@ -85,13 +85,13 @@ export function register () { } else { // Something went wrong, try to subscribe again return unsubscribe({ registration, subscription }).then(subscribe).then( - subscription => sendSubscriptionToBackend(getState, subscription, me)); + subscription => sendSubscriptionToBackend(getState, subscription)); } } // No subscription, try to subscribe return subscribe(registration).then( - subscription => sendSubscriptionToBackend(getState, subscription, me)); + subscription => sendSubscriptionToBackend(getState, subscription)); }) .then(subscription => { // If we got a PushSubscription (and not a subscription object from the backend) @@ -140,7 +140,6 @@ export function saveSettings() { api(getState).put(`/api/web/push_subscriptions/${subscription.get('id')}`, { data, }).then(() => { - const me = getState().getIn(['meta', 'me']); if (me) { pushNotificationsSetting.set(me, data); } diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index f8843d1d9..df6a36379 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -19,13 +19,14 @@ export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT'; export const TIMELINE_CONTEXT_UPDATE = 'CONTEXT_UPDATE'; -export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) { +export function refreshTimelineSuccess(timeline, statuses, skipLoading, next, partial) { return { type: TIMELINE_REFRESH_SUCCESS, timeline, statuses, skipLoading, next, + partial, }; }; @@ -88,7 +89,7 @@ export function refreshTimeline(timelineId, path, params = {}) { return function (dispatch, getState) { const timeline = getState().getIn(['timelines', timelineId], ImmutableMap()); - if (timeline.get('isLoading') || timeline.get('online')) { + if (timeline.get('isLoading') || (timeline.get('online') && !timeline.get('isPartial'))) { return; } @@ -104,8 +105,12 @@ export function refreshTimeline(timelineId, path, params = {}) { dispatch(refreshTimelineRequest(timelineId, skipLoading)); api(getState).get(path, { params }).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(refreshTimelineSuccess(timelineId, response.data, skipLoading, next ? next.uri : null)); + if (response.status === 206) { + dispatch(refreshTimelineSuccess(timelineId, [], skipLoading, null, true)); + } else { + const next = getLinks(response).refs.find(link => link.rel === 'next'); + dispatch(refreshTimelineSuccess(timelineId, response.data, skipLoading, next ? next.uri : null, false)); + } }).catch(error => { dispatch(refreshTimelineFail(timelineId, error, skipLoading)); }); diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap index 533359ffe..29fdc2412 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap @@ -4,14 +4,16 @@ exports[` renders display name + account name 1`] = ` - Foo

", + + Foo

", + } } - } - /> + /> +
); - } else if (!account.get('moved')) { + } else if (!account.get('moved') || following) { buttons = ; } } diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/mastodon/components/attachment_list.js index b3d00b335..9f2d46ddd 100644 --- a/app/javascript/mastodon/components/attachment_list.js +++ b/app/javascript/mastodon/components/attachment_list.js @@ -20,11 +20,11 @@ export default class AttachmentList extends ImmutablePureComponent { ); diff --git a/app/javascript/mastodon/components/collapsable.js b/app/javascript/mastodon/components/collapsable.js index 42ea37ec2..d5d431186 100644 --- a/app/javascript/mastodon/components/collapsable.js +++ b/app/javascript/mastodon/components/collapsable.js @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; const Collapsable = ({ fullHeight, isVisible, children }) => ( - {({ opacity, height }) => + {({ opacity, height }) => (
{children}
- } + )}
); diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index 80a8fbdb3..c300db89b 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -23,7 +23,6 @@ export default class ColumnHeader extends React.PureComponent { icon: PropTypes.string.isRequired, active: PropTypes.bool, multiColumn: PropTypes.bool, - focusable: PropTypes.bool, showBackButton: PropTypes.bool, children: PropTypes.node, pinned: PropTypes.bool, @@ -32,10 +31,6 @@ export default class ColumnHeader extends React.PureComponent { onClick: PropTypes.func, }; - static defaultProps = { - focusable: true, - } - state = { collapsed: true, animating: false, @@ -68,7 +63,7 @@ export default class ColumnHeader extends React.PureComponent { } render () { - const { title, icon, active, children, pinned, onPin, multiColumn, focusable, showBackButton, intl: { formatMessage } } = this.props; + const { title, icon, active, children, pinned, onPin, multiColumn, showBackButton, intl: { formatMessage } } = this.props; const { collapsed, animating } = this.state; const wrapperClassName = classNames('column-header__wrapper', { @@ -135,11 +130,13 @@ export default class ColumnHeader extends React.PureComponent { return (
-

- - - {title} - +

+
{backButton} diff --git a/app/javascript/mastodon/components/display_name.js b/app/javascript/mastodon/components/display_name.js index 2cf84f8f4..a1c56ae35 100644 --- a/app/javascript/mastodon/components/display_name.js +++ b/app/javascript/mastodon/components/display_name.js @@ -12,7 +12,7 @@ export default class DisplayName extends React.PureComponent { return ( - @{this.props.account.get('acct')} + @{this.props.account.get('acct')} ); } diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/mastodon/components/icon_button.js index 06f53841d..b96e48fd0 100644 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/mastodon/components/icon_button.js @@ -93,7 +93,7 @@ export default class IconButton extends React.PureComponent { return ( - {({ rotate }) => + {({ rotate }) => (