From a5f64a0d410d116c43eb127ec6c93b46e784f1c6 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 16 Jul 2017 11:40:56 +0900 Subject: [PATCH 01/14] Install libidn with Docker (#4219) --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 97a6913930..8cd3744818 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN echo "@edge https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/reposit && apk -U upgrade \ && apk add -t build-dependencies \ build-base \ + libidn-dev \ libxml2-dev \ libxslt-dev \ postgresql-dev \ @@ -27,6 +28,7 @@ RUN echo "@edge https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/reposit git \ icu-dev \ imagemagick@edge \ + libidn \ libpq \ libxml2 \ libxslt \ From f3ed02e49220cd0e9e6dad94d8f177cb64c60f05 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 16 Jul 2017 10:28:55 +0200 Subject: [PATCH 02/14] Minor ActivityPub JSON fixes (#4214) - Objects must have attributedTo instead of actor - The current attribute belongs to CollectionPage, not Collection --- app/controllers/activitypub/outboxes_controller.rb | 1 - app/controllers/follower_accounts_controller.rb | 1 - app/controllers/following_accounts_controller.rb | 1 - app/controllers/tags_controller.rb | 1 - app/presenters/activitypub/collection_presenter.rb | 2 +- app/serializers/activitypub/collection_serializer.rb | 3 +-- app/serializers/activitypub/note_serializer.rb | 4 ++-- 7 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/controllers/activitypub/outboxes_controller.rb b/app/controllers/activitypub/outboxes_controller.rb index 6a58ccf243..30b91f3702 100644 --- a/app/controllers/activitypub/outboxes_controller.rb +++ b/app/controllers/activitypub/outboxes_controller.rb @@ -20,7 +20,6 @@ class ActivityPub::OutboxesController < Api::BaseController ActivityPub::CollectionPresenter.new( id: account_outbox_url(@account), type: :ordered, - current: account_outbox_url(@account), size: @account.statuses_count, items: @statuses ) diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb index e58c5ad46e..5edb4d67c8 100644 --- a/app/controllers/follower_accounts_controller.rb +++ b/app/controllers/follower_accounts_controller.rb @@ -21,7 +21,6 @@ class FollowerAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_followers_url(@account), type: :ordered, - current: account_followers_url(@account), size: @account.followers_count, items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) } ) diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb index 69f29cd708..7cafe5fda5 100644 --- a/app/controllers/following_accounts_controller.rb +++ b/app/controllers/following_accounts_controller.rb @@ -21,7 +21,6 @@ class FollowingAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_following_index_url(@account), type: :ordered, - current: account_following_index_url(@account), size: @account.following_count, items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) } ) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 8bcce9e13c..2cd85e185e 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -23,7 +23,6 @@ class TagsController < ApplicationController ActivityPub::CollectionPresenter.new( id: tag_url(@tag), type: :ordered, - current: tag_url(@tag), size: @tag.statuses.count, items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) } ) diff --git a/app/presenters/activitypub/collection_presenter.rb b/app/presenters/activitypub/collection_presenter.rb index 6bae2955ea..631d87cd03 100644 --- a/app/presenters/activitypub/collection_presenter.rb +++ b/app/presenters/activitypub/collection_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model - attributes :id, :type, :current, :size, :items + attributes :id, :type, :size, :items end diff --git a/app/serializers/activitypub/collection_serializer.rb b/app/serializers/activitypub/collection_serializer.rb index baaba76543..d01dead289 100644 --- a/app/serializers/activitypub/collection_serializer.rb +++ b/app/serializers/activitypub/collection_serializer.rb @@ -6,8 +6,7 @@ class ActivityPub::CollectionSerializer < ActiveModel::Serializer super end - attributes :id, :type, :total_items, - :current + attributes :id, :type, :total_items has_many :items, key: :ordered_items diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index ffdc6175d4..4c13f8e596 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -3,7 +3,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer attributes :id, :type, :summary, :content, :in_reply_to, :published, :url, - :actor, :to, :cc, :sensitive + :attributed_to, :to, :cc, :sensitive has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag @@ -36,7 +36,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer ActivityPub::TagManager.instance.url_for(object) end - def actor + def attributed_to ActivityPub::TagManager.instance.uri_for(object.account) end From 160d0e1089a27b91dbe969dbd00cddac089b72ce Mon Sep 17 00:00:00 2001 From: Lynx Kotoura Date: Sun, 16 Jul 2017 18:52:11 +0900 Subject: [PATCH 03/14] Fix style settings for images in media modal (#4220) * Shrink too wide single image modal Fix too wide react-swipeable-view-container Fix 0067f80 shrinking all react-swipeable-view-container Change to apply max-width of react-swipeable-view-container only under media-modal. Fix b30b03b just a typo * Centering contents in image-loader Centering small img, canvas, and video in image-loader. --- app/javascript/styles/components.scss | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/javascript/styles/components.scss b/app/javascript/styles/components.scss index fc797a5086..1c4c97f18a 100644 --- a/app/javascript/styles/components.scss +++ b/app/javascript/styles/components.scss @@ -1143,8 +1143,8 @@ top: 0; left: 0; right: 0; - width: 100%; - height: 100%; + max-width: 100%; + max-height: 100%; background-image: none; } @@ -2967,8 +2967,9 @@ button.icon-button.active i.fa-retweet { video { max-width: 80vw; max-height: 80vh; - width: 100%; + width: auto; height: auto; + margin: auto; } .extended-video-player, @@ -2984,6 +2985,10 @@ button.icon-button.active i.fa-retweet { background: url('../images/void.png') repeat; object-fit: contain; } + + .react-swipeable-view-container { + max-width: 80vw; + } } .media-modal__close { From f32c437a4112dee1c53d792fdd5c8502f1553ab5 Mon Sep 17 00:00:00 2001 From: unarist Date: Sun, 16 Jul 2017 21:02:03 +0900 Subject: [PATCH 04/14] Don't mention default post privacy on hints for locked accounts (#4222) "defaults post privacy to followers-only" only means... * default value of `visibility` param on post API * default value for web UI privacy setting (i.e. it will be overridden if they once updated) ...so, many users won't see an effect of it. --- config/locales/simple_form.en.yml | 2 +- config/locales/simple_form.ja.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index fbaf0ff689..476ccc7731 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -8,7 +8,7 @@ en: one: 1 character left other: %{count} characters left header: PNG, GIF or JPG. At most 2MB. Will be downscaled to 700x335px - locked: Requires you to manually approve followers and defaults post privacy to followers-only + locked: Requires you to manually approve followers note: one: 1 character left other: %{count} characters left diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 9342398a8c..74cf91de46 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -6,7 +6,7 @@ ja: avatar: 2MBまでのPNGやGIF、JPGが利用可能です。120x120pxまで縮小されます。 display_name: あと%{count}文字入力できます。 header: 2MBまでのPNGやGIF、JPGが利用可能です。 700x335pxまで縮小されます。 - locked: フォロワーを手動で承認する必要があります。デフォルトではトゥートの公開範囲はフォロワーのみです。 + locked: フォロワーを手動で承認する必要があります。 note: あと%{count}文字入力できます。 imports: data: 他の Mastodon インスタンスからエクスポートしたCSVファイルを選択して下さい From 0228a2bc8db5c1e17984e87158cc42b4c467dd2d Mon Sep 17 00:00:00 2001 From: unarist Date: Mon, 17 Jul 2017 03:01:21 +0900 Subject: [PATCH 05/14] Check table existence on prepare_for_foreign_keys (#4225) * Check table existence on prepare_for_foreign_keys * Remove trailing whitespace --- lib/tasks/mastodon.rake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 010139e91d..bceeeaf011 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -232,9 +232,16 @@ namespace :mastodon do task prepare_for_foreign_keys: :environment do # All the deletes: ActiveRecord::Base.connection.execute('DELETE FROM statuses USING statuses s LEFT JOIN accounts a ON a.id = s.account_id WHERE statuses.id = s.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM account_domain_blocks USING account_domain_blocks adb LEFT JOIN accounts a ON a.id = adb.account_id WHERE account_domain_blocks.id = adb.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN accounts a ON a.id = cm.account_id WHERE conversation_mutes.id = cm.id AND a.id IS NULL') - ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN conversations c ON c.id = cm.conversation_id WHERE conversation_mutes.id = cm.id AND c.id IS NULL') + + if ActiveRecord::Base.connection.table_exists? :account_domain_blocks + ActiveRecord::Base.connection.execute('DELETE FROM account_domain_blocks USING account_domain_blocks adb LEFT JOIN accounts a ON a.id = adb.account_id WHERE account_domain_blocks.id = adb.id AND a.id IS NULL') + end + + if ActiveRecord::Base.connection.table_exists? :conversation_mutes + ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN accounts a ON a.id = cm.account_id WHERE conversation_mutes.id = cm.id AND a.id IS NULL') + ActiveRecord::Base.connection.execute('DELETE FROM conversation_mutes USING conversation_mutes cm LEFT JOIN conversations c ON c.id = cm.conversation_id WHERE conversation_mutes.id = cm.id AND c.id IS NULL') + end + ActiveRecord::Base.connection.execute('DELETE FROM favourites USING favourites f LEFT JOIN accounts a ON a.id = f.account_id WHERE favourites.id = f.id AND a.id IS NULL') ActiveRecord::Base.connection.execute('DELETE FROM favourites USING favourites f LEFT JOIN statuses s ON s.id = f.status_id WHERE favourites.id = f.id AND s.id IS NULL') ActiveRecord::Base.connection.execute('DELETE FROM blocks USING blocks b LEFT JOIN accounts a ON a.id = b.account_id WHERE blocks.id = b.id AND a.id IS NULL') From 49ef5145ea66552a50c62a5a60b5de119a6c887d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 16 Jul 2017 23:48:35 +0200 Subject: [PATCH 06/14] Add SMTP_TLS variable for configuring TLS when server uses non-standard port (#4227) --- config/environments/production.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index d9c9da684f..f1351e3782 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -85,6 +85,7 @@ Rails.application.configure do :ca_file => ENV['SMTP_CA_FILE'].presence, :openssl_verify_mode => ENV['SMTP_OPENSSL_VERIFY_MODE'], :enable_starttls_auto => ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true, + :tls => ENV['SMTP_TLS'].presence, } config.action_mailer.delivery_method = ENV.fetch('SMTP_DELIVERY_METHOD', 'smtp').to_sym From 9aa95488843fc9528be2694f0150138b894ff2d8 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 17 Jul 2017 02:37:27 +0200 Subject: [PATCH 07/14] Add public key declaration to actors (#4215) --- app/serializers/activitypub/actor_serializer.rb | 6 ++++++ .../activitypub/public_key_serializer.rb | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 app/serializers/activitypub/public_key_serializer.rb diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 56806152ee..f5e626d737 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -7,6 +7,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer :inbox, :outbox, :preferred_username, :name, :summary, :icon, :image + has_one :public_key, serializer: ActivityPub::PublicKeySerializer + def id account_url(object) end @@ -50,4 +52,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer def image full_asset_url(object.header.url(:original)) end + + def public_key + object + end end diff --git a/app/serializers/activitypub/public_key_serializer.rb b/app/serializers/activitypub/public_key_serializer.rb new file mode 100644 index 0000000000..38e9e93baa --- /dev/null +++ b/app/serializers/activitypub/public_key_serializer.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ActivityPub::PublicKeySerializer < ActiveModel::Serializer + attributes :id, :owner, :public_key_pem + + def id + [ActivityPub::TagManager.instance.uri_for(object), '#main-key'].join + end + + def owner + ActivityPub::TagManager.instance.uri_for(object) + end + + def public_key_pem + object.public_key + end +end From 53cb6590762c5ea2243415973c4ab042d111c745 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 17 Jul 2017 17:23:28 +0900 Subject: [PATCH 08/14] Require images in common.js (#4232) --- app/javascript/mastodon/main.js | 2 -- app/javascript/packs/common.js | 2 ++ app/javascript/packs/public.js | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js index 1f8ebb7214..cc422c1099 100644 --- a/app/javascript/mastodon/main.js +++ b/app/javascript/mastodon/main.js @@ -8,8 +8,6 @@ function main() { const React = require('react'); const ReactDOM = require('react-dom'); - require.context('../images/', true); - if (window.history && history.replaceState) { const { pathname, search, hash } = window.location; const path = pathname + search + hash; diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js index a0cb91ae4b..ba7053f1fc 100644 --- a/app/javascript/packs/common.js +++ b/app/javascript/packs/common.js @@ -4,4 +4,6 @@ import { start } from 'rails-ujs'; require('font-awesome/css/font-awesome.css'); require('mastodon-application-style'); +require.context('../images/', true); + start(); diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 6e6ba34769..371e0f4453 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -6,8 +6,6 @@ import { getLocale } from '../mastodon/locales'; import loadPolyfills from '../mastodon/load_polyfills'; import ready from '../mastodon/ready'; -require.context('../images/', true); - const { localeData } = getLocale(); localeData.forEach(IntlRelativeFormat.__addLocaleData); From 1630f8d58c972ebbdf13d3277d2ed0015c7e71b8 Mon Sep 17 00:00:00 2001 From: m4sk1n Date: Mon, 17 Jul 2017 10:24:53 +0200 Subject: [PATCH 09/14] i18n: update (pl) (#4233) * i18n: update (pl) * Update pl.yml --- config/locales/pl.yml | 2 +- config/locales/simple_form.pl.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 6f2831670a..98cfe1b771 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -10,7 +10,7 @@ pl: domain_count_after: instancji domain_count_before: Serwer połączony z features: - humane_approach_body: Nauczeni na błędach innych sieci społecznościowych, Mastodon został zaprojektowany tak, aby uniknąć częstych nadużyć. + humane_approach_body: Nauczeni na błędach innych sieci społecznościowych, zaprojektowaliśmy Mastodona tak, aby uniknąć częstych nadużyć. humane_approach_title: Bardziej ludzkie podejście not_a_product_body: Mastodon nie jest komercyjną siecią. Nie doświadczysz tu reklam, zbierania danych, ani centralnego ośrodka, tak jak w przypadku wielu rozwiązań. not_a_product_title: Jesteś człowiekiem, nie produktem diff --git a/config/locales/simple_form.pl.yml b/config/locales/simple_form.pl.yml index e4c4d7c8c9..5553c75e33 100644 --- a/config/locales/simple_form.pl.yml +++ b/config/locales/simple_form.pl.yml @@ -10,7 +10,7 @@ pl: one: Pozostał 1 znak. other: Pozostało %{count} znaków header: PNG, GIF lub JPG. Maksymalnie 2MB. Zostanie zmniejszony do 700x335px - locked: Musisz akceptować obserwacje; Twoje wpisy są domyślnie widoczne tylko dla Twoich obserwujących + locked: Musisz akceptować prośby o śledzenie note: few: Pozostały %{count} znaki. many: Pozostało %{count} znaków From b4b3bf7c1233048ef45b305708c5dcc28c6e5480 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 17 Jul 2017 10:57:04 +0200 Subject: [PATCH 10/14] Add missing ActivityPub representations (#4230) - Follow, undo follow - Accept follow, reject follow - Like, undo like - Block, undo block - Delete (note) - Update (actor) --- .../activitypub/accept_follow_serializer.rb | 15 +++++++++++++++ .../activitypub/block_serializer.rb | 18 ++++++++++++++++++ .../activitypub/delete_serializer.rb | 18 ++++++++++++++++++ .../activitypub/follow_serializer.rb | 18 ++++++++++++++++++ app/serializers/activitypub/like_serializer.rb | 18 ++++++++++++++++++ .../activitypub/reject_follow_serializer.rb | 15 +++++++++++++++ .../activitypub/undo_block_serializer.rb | 15 +++++++++++++++ .../activitypub/undo_follow_serializer.rb | 15 +++++++++++++++ .../activitypub/undo_like_serializer.rb | 15 +++++++++++++++ .../activitypub/update_serializer.rb | 15 +++++++++++++++ 10 files changed, 162 insertions(+) create mode 100644 app/serializers/activitypub/accept_follow_serializer.rb create mode 100644 app/serializers/activitypub/block_serializer.rb create mode 100644 app/serializers/activitypub/delete_serializer.rb create mode 100644 app/serializers/activitypub/follow_serializer.rb create mode 100644 app/serializers/activitypub/like_serializer.rb create mode 100644 app/serializers/activitypub/reject_follow_serializer.rb create mode 100644 app/serializers/activitypub/undo_block_serializer.rb create mode 100644 app/serializers/activitypub/undo_follow_serializer.rb create mode 100644 app/serializers/activitypub/undo_like_serializer.rb create mode 100644 app/serializers/activitypub/update_serializer.rb diff --git a/app/serializers/activitypub/accept_follow_serializer.rb b/app/serializers/activitypub/accept_follow_serializer.rb new file mode 100644 index 0000000000..ce900bc780 --- /dev/null +++ b/app/serializers/activitypub/accept_follow_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::AcceptFollowSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::FollowSerializer + + def type + 'Accept' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.target_account) + end +end diff --git a/app/serializers/activitypub/block_serializer.rb b/app/serializers/activitypub/block_serializer.rb new file mode 100644 index 0000000000..a001b213b8 --- /dev/null +++ b/app/serializers/activitypub/block_serializer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ActivityPub::BlockSerializer < ActiveModel::Serializer + attributes :type, :actor + attribute :virtual_object, key: :object + + def type + 'Block' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end + + def virtual_object + ActivityPub::TagManager.instance.uri_for(object.target_account) + end +end diff --git a/app/serializers/activitypub/delete_serializer.rb b/app/serializers/activitypub/delete_serializer.rb new file mode 100644 index 0000000000..77098b1b0c --- /dev/null +++ b/app/serializers/activitypub/delete_serializer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ActivityPub::DeleteSerializer < ActiveModel::Serializer + attributes :type, :actor + attribute :virtual_object, key: :object + + def type + 'Delete' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end + + def virtual_object + ActivityPub::TagManager.instance.uri_for(object) + end +end diff --git a/app/serializers/activitypub/follow_serializer.rb b/app/serializers/activitypub/follow_serializer.rb new file mode 100644 index 0000000000..1953a2d7b8 --- /dev/null +++ b/app/serializers/activitypub/follow_serializer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ActivityPub::FollowSerializer < ActiveModel::Serializer + attributes :type, :actor + attribute :virtual_object, key: :object + + def type + 'Follow' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end + + def virtual_object + ActivityPub::TagManager.instance.uri_for(object.target_account) + end +end diff --git a/app/serializers/activitypub/like_serializer.rb b/app/serializers/activitypub/like_serializer.rb new file mode 100644 index 0000000000..4226913f50 --- /dev/null +++ b/app/serializers/activitypub/like_serializer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ActivityPub::LikeSerializer < ActiveModel::Serializer + attributes :type, :actor + attribute :virtual_object, key: :object + + def type + 'Like' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end + + def virtual_object + ActivityPub::TagManager.instance.uri_for(object.status) + end +end diff --git a/app/serializers/activitypub/reject_follow_serializer.rb b/app/serializers/activitypub/reject_follow_serializer.rb new file mode 100644 index 0000000000..28584d6271 --- /dev/null +++ b/app/serializers/activitypub/reject_follow_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::RejectFollowSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::FollowSerializer + + def type + 'Reject' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.target_account) + end +end diff --git a/app/serializers/activitypub/undo_block_serializer.rb b/app/serializers/activitypub/undo_block_serializer.rb new file mode 100644 index 0000000000..f71faa7296 --- /dev/null +++ b/app/serializers/activitypub/undo_block_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::UndoBlockSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::BlockSerializer + + def type + 'Undo' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end +end diff --git a/app/serializers/activitypub/undo_follow_serializer.rb b/app/serializers/activitypub/undo_follow_serializer.rb new file mode 100644 index 0000000000..fe91f5f1c4 --- /dev/null +++ b/app/serializers/activitypub/undo_follow_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::UndoFollowSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::FollowSerializer + + def type + 'Undo' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end +end diff --git a/app/serializers/activitypub/undo_like_serializer.rb b/app/serializers/activitypub/undo_like_serializer.rb new file mode 100644 index 0000000000..db9cd1d0de --- /dev/null +++ b/app/serializers/activitypub/undo_like_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::UndoLikeSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::LikeSerializer + + def type + 'Undo' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end +end diff --git a/app/serializers/activitypub/update_serializer.rb b/app/serializers/activitypub/update_serializer.rb new file mode 100644 index 0000000000..322305da8c --- /dev/null +++ b/app/serializers/activitypub/update_serializer.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivityPub::UpdateSerializer < ActiveModel::Serializer + attributes :type, :actor + + has_one :object, serializer: ActivityPub::ActorSerializer + + def type + 'Update' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object) + end +end From 36d42f83f3c5257253970c5a490f94c03c5d6886 Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Mon, 17 Jul 2017 10:57:45 +0200 Subject: [PATCH 11/14] fix(emojis): Handle multipoint emojis (e.g. country flags) (#4221) --- .../mastodon/features/compose/components/compose_form.js | 2 +- app/javascript/mastodon/reducers/compose.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index f075529479..98e8235550 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -136,7 +136,7 @@ export default class ComposeForm extends ImmutablePureComponent { handleEmojiPick = (data) => { const position = this.autosuggestTextarea.textarea.selectionStart; - const emojiChar = String.fromCodePoint(parseInt(data.unicode, 16)); + const emojiChar = data.unicode.split('-').map(code => String.fromCodePoint(parseInt(code, 16))).join(''); this._restoreCaret = position + emojiChar.length + 1; this.props.onPickEmoji(position, data); } diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index ea3b78b67a..781e6e11b9 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -118,7 +118,7 @@ const insertSuggestion = (state, position, token, completion) => { }; const insertEmoji = (state, position, emojiData) => { - const emoji = String.fromCodePoint(parseInt(emojiData.unicode, 16)); + const emoji = emojiData.unicode.split('-').map(code => String.fromCodePoint(parseInt(code, 16))).join(''); return state.withMutations(map => { map.update('text', oldText => `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}`); From 71a02eb2d9c87095ee3a040c58c86afc8df0e55d Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 17 Jul 2017 18:03:42 +0900 Subject: [PATCH 12/14] Use update method to update session in WebPushNotificationWorker (#4235) --- app/workers/web_push_notification_worker.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/workers/web_push_notification_worker.rb b/app/workers/web_push_notification_worker.rb index 0568a3e028..f14efc99e1 100644 --- a/app/workers/web_push_notification_worker.rb +++ b/app/workers/web_push_notification_worker.rb @@ -17,8 +17,7 @@ class WebPushNotificationWorker rescue Webpush::InvalidSubscription, Webpush::ExpiredSubscription # Subscription expiration is not currently implemented in any browser session.web_push_subscription.destroy! - session.web_push_subscription = nil - session.save! + session.update!(web_push_subscription: nil) rescue Webpush::PayloadTooLarge => e Rails.logger.error(e) end From 6eff4496e3147c0c6712185132402384c7113864 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 17 Jul 2017 18:03:48 +0900 Subject: [PATCH 13/14] Improve a query in WebPushNotificationWorker (#4234) --- app/workers/web_push_notification_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/web_push_notification_worker.rb b/app/workers/web_push_notification_worker.rb index f14efc99e1..e8f1d72bd4 100644 --- a/app/workers/web_push_notification_worker.rb +++ b/app/workers/web_push_notification_worker.rb @@ -9,7 +9,7 @@ class WebPushNotificationWorker recipient = Account.find(recipient_id) notification = Notification.find(notification_id) - sessions_with_subscriptions = recipient.user.session_activations.reject { |session| session.web_push_subscription.nil? } + sessions_with_subscriptions = recipient.user.session_activations.where.not(web_push_subscription: nil) sessions_with_subscriptions.each do |session| begin From 64202d0fcf7cd2e5f0b1fae0737bb2345e7c5c19 Mon Sep 17 00:00:00 2001 From: Lynx Kotoura Date: Tue, 18 Jul 2017 02:05:29 +0900 Subject: [PATCH 14/14] Quit overwriting style of extended-video-player (#4237) Though size of extended-video-player is already fixed to 80vw*80vh in components.scss, player size was also set to original video size in extended_video_player.js. Video size is fixed to 80vw*80vh, so video player's size must also be fixed to 80vw*80vh. --- app/javascript/mastodon/components/extended_video_player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/components/extended_video_player.js b/app/javascript/mastodon/components/extended_video_player.js index b38a4b8ff1..5ab5e9e586 100644 --- a/app/javascript/mastodon/components/extended_video_player.js +++ b/app/javascript/mastodon/components/extended_video_player.js @@ -32,7 +32,7 @@ export default class ExtendedVideoPlayer extends React.PureComponent { render () { return ( -
+