From f0f8b242c4ccd3603a60ba5decf7dc225000a017 Mon Sep 17 00:00:00 2001 From: "Mélanie Chauvel (ariasuni)" Date: Thu, 21 Jun 2018 23:05:01 +0200 Subject: Fix CW field still having animation in when reduce motion is enabled (#7872) --- app/javascript/styles/mastodon/components.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 28daac6a3..c16cf3437 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -302,12 +302,10 @@ height: 0; transform-origin: bottom; opacity: 0.0; - transition: all 0.4s ease; &.spoiler-input--visible { height: 47px; opacity: 1.0; - transition: all 0.4s ease; } } @@ -568,6 +566,10 @@ } } +.no-reduce-motion .spoiler-input { + transition: height 0.4s ease, opacity 0.4s ease; +} + .emojione { font-size: inherit; vertical-align: middle; -- cgit From 23955d956e799538b3e05fcd967390a541cfe473 Mon Sep 17 00:00:00 2001 From: Shuhei Kitagawa Date: Sun, 24 Jun 2018 19:55:55 +0900 Subject: Add tests for remote_unfollows_controller (#7879) --- app/controllers/remote_unfollows.rb | 39 ---------------------- app/controllers/remote_unfollows_controller.rb | 39 ++++++++++++++++++++++ .../remote_unfollows_controller_spec.rb | 38 +++++++++++++++++++++ 3 files changed, 77 insertions(+), 39 deletions(-) delete mode 100644 app/controllers/remote_unfollows.rb create mode 100644 app/controllers/remote_unfollows_controller.rb create mode 100644 spec/controllers/remote_unfollows_controller_spec.rb (limited to 'app') diff --git a/app/controllers/remote_unfollows.rb b/app/controllers/remote_unfollows.rb deleted file mode 100644 index af5943363..000000000 --- a/app/controllers/remote_unfollows.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -class RemoteUnfollowsController < ApplicationController - layout 'modal' - - before_action :authenticate_user! - before_action :set_body_classes - - def create - @account = unfollow_attempt.try(:target_account) - - if @account.nil? - render :error - else - render :success - end - rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError - render :error - end - - private - - def unfollow_attempt - username, domain = acct_without_prefix.split('@') - UnfollowService.new.call(current_account, Account.find_remote!(username, domain)) - end - - def acct_without_prefix - acct_params.gsub(/\Aacct:/, '') - end - - def acct_params - params.fetch(:acct, '') - end - - def set_body_classes - @body_classes = 'modal-layout' - end -end diff --git a/app/controllers/remote_unfollows_controller.rb b/app/controllers/remote_unfollows_controller.rb new file mode 100644 index 000000000..af5943363 --- /dev/null +++ b/app/controllers/remote_unfollows_controller.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +class RemoteUnfollowsController < ApplicationController + layout 'modal' + + before_action :authenticate_user! + before_action :set_body_classes + + def create + @account = unfollow_attempt.try(:target_account) + + if @account.nil? + render :error + else + render :success + end + rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError + render :error + end + + private + + def unfollow_attempt + username, domain = acct_without_prefix.split('@') + UnfollowService.new.call(current_account, Account.find_remote!(username, domain)) + end + + def acct_without_prefix + acct_params.gsub(/\Aacct:/, '') + end + + def acct_params + params.fetch(:acct, '') + end + + def set_body_classes + @body_classes = 'modal-layout' + end +end diff --git a/spec/controllers/remote_unfollows_controller_spec.rb b/spec/controllers/remote_unfollows_controller_spec.rb new file mode 100644 index 000000000..223ed64af --- /dev/null +++ b/spec/controllers/remote_unfollows_controller_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe RemoteUnfollowsController do + render_views + + describe '#create' do + subject { post :create, params: { acct: acct } } + + let(:current_user) { Fabricate(:user, account: current_account) } + let(:current_account) { Fabricate(:account) } + let(:remote_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } + before do + sign_in current_user + current_account.follow!(remote_account) + stub_request(:post, 'http://example.com/inbox'){ { status: 200 } } + end + + context 'when successfully unfollow remote account' do + let(:acct) {"acct:#{ remote_account.username }@#{ remote_account.domain }"} + + it do + is_expected.to render_template :success + expect(current_account.following?(remote_account)).to be false + end + end + + context 'when fails to unfollow remote account' do + let(:acct) {"acct:#{ remote_account.username + '_test' }@#{ remote_account.domain }"} + + it do + is_expected.to render_template :error + expect(current_account.following?(remote_account)).to be true + end + end + end +end -- cgit From 50a2854f922ebdd2c056870a0de402329bdf1bb3 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 24 Jun 2018 13:33:06 +0200 Subject: Fix jpeg files sometimes being returned with a .jpe extension (#7881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While this isn't exactly *wrong*, files uploaded with a “.jpe” extension will keep that extension, which will often cause them to be served with an incorrect mimetype. --- app/models/concerns/attachmentable.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb index db63c3eca..44bdfa39a 100644 --- a/app/models/concerns/attachmentable.rb +++ b/app/models/concerns/attachmentable.rb @@ -42,8 +42,9 @@ module Attachmentable extensions_for_mime_type = mime_type.empty? ? [] : mime_type.first.extensions original_extension = Paperclip::Interpolations.extension(attachment, :original) proper_extension = extensions_for_mime_type.first.to_s - proper_extension = 'jpeg' if proper_extension == 'jpe' + extension = extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension + extension = 'jpeg' if extension == 'jpe' - extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension + extension end end -- cgit