Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tootsuite/mastodon into 2…
Browse files Browse the repository at this point in the history
…fa-password

* 'master' of https://github.com/tootsuite/mastodon: (72 commits)
  Bump version to 2.2.0
  Fix padding bug in landing page column header (mastodon#6374)
  ASSET_HOST is wrong env variable. Fix to CDN_HOST (mastodon#6372)
  Add direction tags to HTML e-mails for RTL languages (mastodon#6373)
  Weblate translations (mastodon#6370)
  l10n Occitan update (mastodon#6367)
  Do not manually update system RubyGems (mastodon#6355)
  Do not require sudo on Travis CI (mastodon#6356)
  Fix initial_state me in push_notification_register (mastodon#6349)
  Fix hide and show media button on admin page (mastodon#6347)
  Add packs volume to docker-compose.yml (mastodon#6348)
  l10n Occitan language update (mastodon#6346)
  Bump to 2.2.0rc2
  Fix style of legacy column headers (mastodon#6342)
  Fix mastodon#6311: Replace relative URLs in CSS only for Premailer (mastodon#6335)
  Fix mastodon#6331 (mastodon#6341)
  Display deleted users' role as “Suspended” (mastodon#6339)
  Update goldfinger, ostatus2 and http.rb versions (mastodon#6337)
  Fix e-mail icon for reblog being stretched (mastodon#6336)
  Fix regression from mastodon#6199: Make entire column header clickable (mastodon#6334)
  ...
  • Loading branch information
pfigel committed Jan 31, 2018
2 parents 80b423b + e14c205 commit 409ddb2
Show file tree
Hide file tree
Showing 460 changed files with 6,444 additions and 3,083 deletions.
1 change: 1 addition & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ plugins:
enabled: true
eslint:
enabled: true
channel: eslint-4
rubocop:
enabled: true
scss-lint:
Expand Down
19 changes: 12 additions & 7 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.2
2.5.0
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ cache:
- public/packs-test
- tmp/cache/babel-loader
dist: trusty
sudo: required
sudo: false
branches:
only:
- master

notifications:
email: false
Expand Down Expand Up @@ -37,8 +40,8 @@ addons:
- yarn

rvm:
- 2.3.4
- 2.4.2
- 2.5.0

services:
- redis-server
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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" \
Expand Down
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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'
Expand All @@ -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'
Expand Down
44 changes: 27 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -639,7 +649,7 @@ DEPENDENCIES
webpush

RUBY VERSION
ruby 2.4.2p198
ruby 2.5.0p0

BUNDLED WITH
1.16.1
2 changes: 1 addition & 1 deletion app/controllers/activitypub/inboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def body
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?
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/api/v1/timelines/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,4 +61,8 @@ def pagination_max_id
def pagination_since_id
@statuses.first.id
end

def regeneration_in_progress?
Redis.current.exists("account:#{current_account.id}:regeneration")
end
end
1 change: 1 addition & 0 deletions app/controllers/api/web/push_subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/authorize_follows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def account_from_remote_fetch
end

def account_from_remote_follow
ResolveRemoteAccountService.new.call(acct_without_prefix)
ResolveAccountService.new.call(acct_without_prefix)
end

def acct_param_is_url?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/signature_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def incompatible_signature?(signature_params)

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)
Expand Down
16 changes: 0 additions & 16 deletions app/controllers/concerns/user_tracking_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module UserTrackingConcern
extend ActiveSupport::Concern

REGENERATE_FEED_DAYS = 14
UPDATE_SIGN_IN_HOURS = 24

included do
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ConfirmationsController < ApplicationController
layout 'admin'

before_action :authenticate_user!
before_action :ensure_otp_secret

def new
prepare_two_factor_form
Expand Down Expand Up @@ -38,6 +39,10 @@ def prepare_two_factor_form
@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
3 changes: 2 additions & 1 deletion app/controllers/shares_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ def show
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

Expand Down
Loading

0 comments on commit 409ddb2

Please sign in to comment.