Skip to content

Commit

Permalink
ME3をv2.1.2に追従。 (#6)
Browse files Browse the repository at this point in the history
* Remove period from the version number (mastodon#6039)

2.1.0. -> 2.1.0

* Add Slovak translation (mastodon#6052)

* Add Slovak translation

* Slovak translation: i18n-normalize

* Update Korean translation (mastodon#6050)

* Update Korean translation

* Translate Korean for javascript

* Add missing translations on simple_form

* Replace <code> to <kbd> in KeyboardShortcuts component (mastodon#6049)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Rename settingKey in setting_toggle to settingPath (mastodon#6046)

* Display deleted users' role as “Suspended” (mastodon#6080)

Deleted users are technically suspended, but the code displaying their status
in the admin interface was broken and displayed a javascript object holding
translations of the possible user roles instead.

* Reduce the number of synchronous resolves when posting toots (mastodon#6075)

* enforce LOCAL_HTTPS=true in production (mastodon#6061)

* enforce https in production

* note changes in production env sample

* typo fix

* Move dropdown transform origin to top edge (mastodon#6091)

* removed references to hideOnMobile in column_link and getting_started (mastodon#6082)

* removed references to hideOnMobile in column_link and getting_started

* move keyboard shortcuts back below blocked users

* Refactor web_push_subscription (mastodon#6047)

* Remove onSave method in mapped properties for column_settings

* Make web_push_subscription.register an action

* Reduce motion for boost animation (mastodon#5871)

* Reduce motion for boost animation

Fixes mastodon#5833

* Fix ternary expression

* Add validation for onMuteNotifications (mastodon#6092)

* Add aria-autocomplete='list' in Textaria

ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete

* Make detect empty string brefore assign upload description

* Change code elements in keyboard-shortcuts component to kbd

* Add validation for onMuteNotifications

* Add rake task to check and purge accounts that are missing in origin (mastodon#6085)

* Add rake task to check and purge accounts that are missing in origin

* Add progress bar and --force options to mastodon:maintenance:purge_removed_accounts

* Add supported Node.js version to package.json (mastodon#6096)

* Additional prop name change. (mastodon#6098)

* Add mute, block, conversation mute actions to detailed status dropdown menu (mastodon#6099)

* removed references to hideOnMobile in column_link and getting_started

* add mute, block, conversationMute actions to detailed status dropdown (fixes mastodon#1226)

* remove unused withDismiss in detailed status

* more faster index on notifications table (mastodon#6108)

* add ruby-progressbar to gemfile (fixes mastodon#6110) (mastodon#6111)

* Fix XML oEmbed support discovery (mastodon#6104)

* Move the mastodon on Getting Started column to drawer column (mastodon#6109)

Getting Started column obtained many links, and it became much taller.
Because of its height, Getting Started column required long scrolling on
devices with small screen, such as 4 inch phones and 10 inch laptops.

This change moves the mastodon which took large space on the column to
drawer column. The drawer column has only the compose form and has more
space.

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100) (mastodon#6101)

* Make host_meta/webfinger replies cacheable (fixes mastodon#6100)

Drop common code for handling users and sessions as webfinger queries
are very basic, public APIs.

Also explicitly mark results as cacheable with “expires_in”.

* Add “Vary: Accept” header for caching since content-negociation is used

* bug fix (WebPush does not work) (mastodon#6120)

* Add more instance stats APIs (mastodon#6125)

* Add GET /api/v1/instance/peers API to reveal known domains

* Add GET /api/v1/instance/activity API

* Make new APIs disableable, exclude private statuses from activity stats

* Fix code style issue

* Fix week timestamps

* keep the same filters and page when doing custom emojo stuff (fixes mastodon#6112) (mastodon#6114)

* Translate Korean (mastodon#6131)

Relates to mastodon#6125, mastodon#6099

* Adding Serbian translation (mastodon#6133)

* Adding Serbian translation

* i18n-tasks normalize

* Show mastodon on modal (mastodon#6129)

* Use const instead of let for constant (mastodon#6106)

* Adding Serbian latin translations (mastodon#6146)

Serbian latin (sr-Latn) is generated automatically from Serbian (sr) translation. Also changed some wording in original (Serbian) translation.

* delete X-UA-Compatible (mastodon#6068)

* delete X-UA-Compatible

* undo

* restore

* Rename key to path in actions and reducers for settings (mastodon#6105)

* Fix stats expiring too quickly because of variable mistake (mastodon#6155)

* Display a warning when composing unlisted toots with something looking like a hashtag (mastodon#6132)

* Add confirmation step for email changes (mastodon#6071)

* Add confirmation step for email changes

This adds a confirmation step for email changes of existing users.
Like the initial account confirmation, a confirmation link is sent
to the new address.

Additionally, a notification is sent to the existing address when
the change is initiated. This message includes instruction to reset
the password immediately or to contact the instance admin if the
change was not initiated by the account owner.

Fixes mastodon#3871

* Add review fixes

* Fix newlines-to-spaces functionality (mastodon#6158)

yay for regexes, amirite

* Don't leave behind husk of remotely-deleted profile (mastodon#6159)

There's no reason for an Account record to persist after Delete->Actor is received. SuspendAccountService is necessary to make sure deleted toots get sent over streaming API properly and home feeds get cleaned up. By removing Account record, we can ensure that if in the future the account is restored remotely (or username reused), it can start with a clean slate.

* Update moved-to property when it's removed too (mastodon#6160)

* Fix mastodon#6140 - Update moved-to property when it's removed too

* Remove trailing whitespace

* [!] Sanitize incoming classlist properly (mastodon#6162)

* Sanitize classlist properly

* Actually properly sanitize every class after the first

* Improve Formatter spec to check for multiple classes and non-space whitespace

* Set background to the navigation of Getting Started column (mastodon#6163)

The background of the navigation matters because its scrollbar is
transparent.

* Allow HTTP caching of json view of public statuses (mastodon#6115)

* Allow HTTP caching of json view of public statuses

HTML views are not cached as they can contain private statuses as well

* Disable session cookies for ActivityPub json rendering of public toots

* Add Japanese translations mastodon#5997, mastodon#6003, mastodon#6004, mastodon#6071, mastodon#6099, mastodon#6125 and mastodon#6132 (mastodon#6167)

* yarn manage:translations

* Add Japanese translation for mastodon#5997

* Add Japanese translation for mastodon#6003

* Add Japanese translation for mastodon#6004

* Add Japanese translation for mastodon#6071

* Add Japanese translation for mastodon#6099

* Add Japanese translation for mastodon#6125

* Add Japanese translation for mastodon#6132

* i18n: Update Polish translation (mastodon#6168)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Allow to dereference Follow object for ActivityPub (mastodon#5772)

* Allow to dereference Follow object for ActivityPub

* Accept IRI as object representation for Accept activity

* Don't normalize URLs in toots (mastodon#6134)

* Don't normalize URLs in toots

URL normalization is ill-defined and may cause certain links to break.

* Change specs since we are not normalizing user-provided URLs

* l10n OC language (mastodon#6169)

* new strings: hashtag+unlisted, mute, block

* Add confirmation step for email changes

* Add more instance stats APIs

* Cache JSON of immutable ActivityPub representations (mastodon#6171)

* Fix OpenSSL dependency in ostatus2 (mastodon#6174)

* Fix nil error in log_target_from_history helper (mastodon#6173)

* Rearrange items in Getting Started navigation (mastodon#6126)

Though the subsections are representing features such as navigation and
settings, they are categorized by the ways how they are implemented
(internal navigation or external links.) They are irrelevant and some
arrangements were confusing because of that. (It is nonsense that instance
information is in settings subsection, for example.)

This fixes the issue by rearranging.

* Fix FetchAtomService not finding alternatives if there's a Link header (mastodon#6170)

without them, such as is the case with GNU social

Fixes the ability to find GNU social accounts via URL in search and
when using remote follow function

* Improve Traditional Chinese translation (mastodon#6166)

* Improve Traditional Chinese translations

* Sort alphabetically

* Make sure private toots remain private and do not end up in HTTP caches (mastodon#6175)

* Send one Delete of Actor in ActivityPub when account is suspended (mastodon#6172)

* i18n: Update Polish translation (mastodon#6176)

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>

* Fallback default thumbnail in instance status API (mastodon#6177)

* Bump version to 2.1.1 (mastodon#6164)

* Use disable_ddl_transaction! to prevent warnings on migration (mastodon#6183)

Migration is wrapped by transaction, so manual `commit_db_transaction` without transaction restarting causes "there is no transaction in progress" warnings. We should use `disable_ddl_transaction!` instead, if we can omit transaction completely.

* Fix overflowing audit logs (mastodon#6184)

* Fix email confirmation link not updating email (mastodon#6187)

A change introduced in mastodon#6125 prevents
`Devise::Models::Confirmable#confirm` from being called for existing
users, which in turn leads to `email` not being set to
`unconfirmed_email`, breaking email updates. This also adds a test
that would've caught this issue.

* Small translation fixes for Serbian (and sr@Latn too) (mastodon#6188)

* Fix RFC 5646 Regular Expression (mastodon#6190)

* Bump version to 2.1.2

* l10n Occitan language: mailer update (mastodon#6193)

* Create email_changed.oc.html.erb

* Create email_changed.oc.text.erb

* Update email_changed.oc.html.erb

* Update email_changed.oc.html.erb

* Create reconfirmation_instructions.oc.html.erb

* Create reconfirmation_instructions.oc.text.erb

* Update confirmation_instructions.oc.html.erb

* Update confirmation_instructions.oc.text.erb

* Update confirmation_instructions.oc.html.erb

* Update reconfirmation_instructions.oc.html.erb

* Update reconfirmation_instructions.oc.text.erb

* Update reconfirmation_instructions.oc.html.erb

* Fix enforce HTTPS in production. (mastodon#6180)

* Represent numbers by strings in instance activity API (mastodon#6198)

Fixes mastodon#6197.

* When fetching an ActivityPub-enabled status, do not re-request it as text/html (mastodon#6196)

* Fix PuSH workers (mastodon#6200)
  • Loading branch information
GenbuHase committed Jan 8, 2018
1 parent d1334c8 commit 20c0eee
Show file tree
Hide file tree
Showing 203 changed files with 4,966 additions and 574 deletions.
5 changes: 3 additions & 2 deletions .env.production.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ DB_PASS=
DB_PORT=5432

# Federation
# Note: Changing LOCAL_DOMAIN or LOCAL_HTTPS at a later time will cause unwanted side effects.
# Note: Changing LOCAL_DOMAIN at a later time will cause unwanted side effects, including breaking all existing federation.
# LOCAL_DOMAIN should *NOT* contain the protocol part of the domain e.g https://example.com.
LOCAL_DOMAIN=example.com
LOCAL_HTTPS=true

# Changing LOCAL_HTTPS in production is no longer supported. (Mastodon will always serve https:// links)

# Use this only if you need to run mastodon on a different domain than the one used for federation.
# You can read more about this option on https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Serving_a_different_domain.md
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem 'browser'
gem 'charlock_holmes', '~> 0.7.5'
gem 'iso-639'
gem 'cld3', '~> 3.2.0'
gem 'devise', '~> 4.2'
gem 'devise', '~> 4.3'
gem 'devise-two-factor', '~> 3.0'
gem 'doorkeeper', '~> 4.2'
gem 'fast_blank', '~> 1.0'
Expand Down Expand Up @@ -58,6 +58,7 @@ gem 'redis', '~> 3.3', require: ['redis', 'redis/connection/hiredis']
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
gem 'rqrcode', '~> 0.10'
gem 'ruby-oembed', '~> 0.12', require: 'oembed'
gem 'ruby-progressbar', '~> 1.4'
gem 'sanitize', '~> 4.4'
gem 'sidekiq', '~> 5.0'
gem 'sidekiq-scheduler', '~> 2.1'
Expand Down
9 changes: 4 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,11 @@ GEM
sidekiq (>= 3.5.0)
statsd-ruby (~> 1.2.0)
oj (3.3.9)
openssl (2.0.6)
orm_adapter (0.5.0)
ostatus2 (2.0.1)
ostatus2 (2.0.2)
addressable (~> 2.4)
http (~> 2.0)
nokogiri (~> 1.6)
openssl (~> 2.0)
ox (2.8.2)
paperclip (5.1.0)
activemodel (>= 4.2.0)
Expand Down Expand Up @@ -561,7 +559,7 @@ DEPENDENCIES
charlock_holmes (~> 0.7.5)
cld3 (~> 3.2.0)
climate_control (~> 0.2)
devise (~> 4.2)
devise (~> 4.3)
devise-two-factor (~> 3.0)
doorkeeper (~> 4.2)
dotenv-rails (~> 2.2)
Expand Down Expand Up @@ -621,6 +619,7 @@ DEPENDENCIES
rspec-sidekiq (~> 3.0)
rubocop
ruby-oembed (~> 0.12)
ruby-progressbar (~> 1.4)
sanitize (~> 4.4)
scss_lint (~> 0.55)
sidekiq (~> 5.0)
Expand All @@ -643,4 +642,4 @@ RUBY VERSION
ruby 2.4.2p198

BUNDLED WITH
1.16.0
1.16.1
12 changes: 7 additions & 5 deletions app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

class AccountsController < ApplicationController
include AccountControllerConcern
include SignatureVerification

before_action :set_cache_headers

def show
respond_to do |format|
Expand All @@ -26,10 +27,11 @@ def show
end

format.json do
render json: @account,
serializer: ActivityPub::ActorSerializer,
adapter: ActivityPub::Adapter,
content_type: 'application/activity+json'
skip_session!

render_cached_json(['activitypub', 'actor', @account.cache_key], content_type: 'application/activity+json') do
ActiveModelSerializers::SerializableResource.new(@account, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter)
end
end
end
end
Expand Down
22 changes: 22 additions & 0 deletions app/controllers/activitypub/follows_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

class ActivityPub::FollowsController < Api::BaseController
include SignatureVerification

def show
render json: follow_request,
serializer: ActivityPub::FollowSerializer,
adapter: ActivityPub::Adapter,
content_type: 'application/activity+json'
end

private

def follow_request
FollowRequest.includes(:account).references(:account).find_by!(
id: params.require(:id),
accounts: { domain: nil, username: params.require(:account_username) },
target_account: signed_request_account
)
end
end
24 changes: 17 additions & 7 deletions app/controllers/admin/custom_emojis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Admin
class CustomEmojisController < BaseController
before_action :set_custom_emoji, except: [:index, :new, :create]
before_action :set_filter_params

def index
authorize :custom_emoji, :index?
Expand Down Expand Up @@ -32,23 +33,26 @@ def update

if @custom_emoji.update(resource_params)
log_action :update, @custom_emoji
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.updated_msg')
flash[:notice] = I18n.t('admin.custom_emojis.updated_msg')
else
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.update_failed_msg')
flash[:alert] = I18n.t('admin.custom_emojis.update_failed_msg')
end
redirect_to admin_custom_emojis_path(page: params[:page], **@filter_params)
end

def destroy
authorize @custom_emoji, :destroy?
@custom_emoji.destroy!
log_action :destroy, @custom_emoji
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.destroyed_msg')
flash[:notice] = I18n.t('admin.custom_emojis.destroyed_msg')
redirect_to admin_custom_emojis_path(page: params[:page], **@filter_params)
end

def copy
authorize @custom_emoji, :copy?

emoji = CustomEmoji.find_or_initialize_by(domain: nil, shortcode: @custom_emoji.shortcode)
emoji = CustomEmoji.find_or_initialize_by(domain: nil,
shortcode: @custom_emoji.shortcode)
emoji.image = @custom_emoji.image

if emoji.save
Expand All @@ -58,21 +62,23 @@ def copy
flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg')
end

redirect_to admin_custom_emojis_path(page: params[:page])
redirect_to admin_custom_emojis_path(page: params[:page], **@filter_params)
end

def enable
authorize @custom_emoji, :enable?
@custom_emoji.update!(disabled: false)
log_action :enable, @custom_emoji
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.enabled_msg')
flash[:notice] = I18n.t('admin.custom_emojis.enabled_msg')
redirect_to admin_custom_emojis_path(page: params[:page], **@filter_params)
end

def disable
authorize @custom_emoji, :disable?
@custom_emoji.update!(disabled: true)
log_action :disable, @custom_emoji
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.disabled_msg')
flash[:notice] = I18n.t('admin.custom_emojis.disabled_msg')
redirect_to admin_custom_emojis_path(page: params[:page], **@filter_params)
end

private
Expand All @@ -81,6 +87,10 @@ def set_custom_emoji
@custom_emoji = CustomEmoji.find(params[:id])
end

def set_filter_params
@filter_params = filter_params.to_hash.symbolize_keys
end

def resource_params
params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker)
end
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/admin/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ class SettingsController < BaseController
bootstrap_timeline_accounts
thumbnail
min_invite_role
activity_api_enabled
peers_api_enabled
).freeze

BOOLEAN_SETTINGS = %w(
open_registrations
open_deletion
timeline_preview
show_staff_badge
activity_api_enabled
peers_api_enabled
).freeze

UPLOAD_SETTINGS = %w(
Expand Down
36 changes: 36 additions & 0 deletions app/controllers/api/v1/instances/activity_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

class Api::V1::Instances::ActivityController < Api::BaseController
before_action :require_enabled_api!

respond_to :json

def show
render_cached_json('api:v1:instances:activity:show', expires_in: 1.day) { activity }
end

private

def activity
weeks = []

12.times do |i|
day = i.weeks.ago.to_date
week_id = day.cweek
week = Date.commercial(day.cwyear, week_id)

weeks << {
week: week.to_time.to_i.to_s,
statuses: Redis.current.get("activity:statuses:local:#{week_id}") || '0',
logins: Redis.current.pfcount("activity:logins:#{week_id}").to_s,
registrations: Redis.current.get("activity:accounts:local:#{week_id}") || '0',
}
end

weeks
end

def require_enabled_api!
head 404 unless Setting.activity_api_enabled
end
end
17 changes: 17 additions & 0 deletions app/controllers/api/v1/instances/peers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

class Api::V1::Instances::PeersController < Api::BaseController
before_action :require_enabled_api!

respond_to :json

def index
render_cached_json('api:v1:instances:peers:index', expires_in: 1.day) { Account.remote.domains }
end

private

def require_enabled_api!
head 404 unless Setting.peers_api_enabled
end
end
22 changes: 22 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,26 @@ def respond_with_error(code)
end
end
end

def render_cached_json(cache_key, **options)
options[:expires_in] ||= 3.minutes
options[:public] ||= true
cache_key = cache_key.join(':') if cache_key.is_a?(Enumerable)
content_type = options.delete(:content_type) || 'application/json'

data = Rails.cache.fetch(cache_key, { raw: true }.merge(options)) do
yield.to_json
end

expires_in options[:expires_in], public: options[:public]
render json: data, content_type: content_type
end

def set_cache_headers
response.headers['Vary'] = 'Accept'
end

def skip_session!
request.session_options[:skip] = true
end
end
6 changes: 0 additions & 6 deletions app/controllers/auth/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@

class Auth::ConfirmationsController < Devise::ConfirmationsController
layout 'auth'

def show
super do |user|
BootstrapTimelineWorker.perform_async(user.account_id) if user.errors.empty?
end
end
end
4 changes: 4 additions & 0 deletions app/controllers/auth/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def after_inactive_sign_up_path_for(_resource)
new_user_session_path
end

def after_update_path_for(_resource)
edit_user_registration_path
end

def check_enabled_registrations
redirect_to root_path if single_user_mode? || !allowed_registrations?
end
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/authorize_follows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class AuthorizeFollowsController < ApplicationController
layout 'modal'

before_action :authenticate_user!
before_action :set_body_classes

def show
@account = located_account || render(:error)
Expand Down Expand Up @@ -58,4 +59,8 @@ def acct_without_prefix
def acct_params
params.fetch(:acct, '')
end

def set_body_classes
@body_classes = 'modal-layout'
end
end
1 change: 1 addition & 0 deletions app/controllers/concerns/user_tracking_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def set_user_activity

# 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?
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/emojis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

class EmojisController < ApplicationController
before_action :set_emoji
before_action :set_cache_headers

def show
respond_to do |format|
format.json do
render json: @emoji,
serializer: ActivityPub::EmojiSerializer,
adapter: ActivityPub::Adapter,
content_type: 'application/activity+json'
skip_session!

render_cached_json(['activitypub', 'emoji', @emoji.cache_key], content_type: 'application/activity+json') do
ActiveModelSerializers::SerializableResource.new(@emoji, serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter)
end
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/remote_follow_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ def set_account
def suspended_account?
@account.suspended?
end

def set_body_classes
@body_classes = 'modal-layout'
end
end
2 changes: 1 addition & 1 deletion app/controllers/shares_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ def initial_state_params
end

def set_body_classes
@body_classes = 'compose-standalone'
@body_classes = 'modal-layout compose-standalone'
end
end
Loading

0 comments on commit 20c0eee

Please sign in to comment.